3 ms·
>"Any protocol using DMA already does exactly this through interrupts or other message passing systems." Interesting, I'm only familiar with the classic interr
by bogomipz 4y ago
>"Any protocol using DMA already does exactly this through interrupts or other message passing systems."
Interesting, I'm only familiar with the classic interrupts approach. What are some of the other common message passing systems used in DMA?
- wtallis 4y agoNVMe has memory-mapped doorbell registers associated with each submission or completion queue, which are ring buffers typically allocated in host RAM and accessed by the SSD using DMA. Generating interrupts when a new entry is posted to a completion queue is optional. The host system can instead simply poll the completion queue to check whether any new IO operations have been completed. Depending on how busy the drive is vs how busy the CPU is, forgoing interrupts in favor of polling may reduce latency (fewer context switches when handling a new completion), but can also burn a lot of CPU time.
- bogomipz 4y agoThis is really interesting. I wasn't aware that interrupts were handled differently on NVMe disks. The falling back to polling during busy times is similar to the way network device drivers do NAPI then?
- wtallis 4y agoPolling is optional. The Linux driver defaults to using interrupts only, but the nvme driver can be passed an option to allocate one or more queues with interrupts disabled to be used for polled IO. (You can also configure it to use separate queues for reads and writes, instead of just trying to allocate one queue per CPU core.)