Commit e25e56e
committed
nvme: CQ db_buf EventIdx should slightly lag CQ tail
Doorbell buffers want the CQ event index to roughly track with the tail,
because most CQ doorbells are not interesting. If there are ten CQ
entries, space for 54 more, and the guest has acknowledged one, we don't
really care anything happened.
If there are 64 CQ entries, 0 available,
and one SQ entry that we're notified for, we'll try to reserve space in
a full CQ, see it's at capacity, and the SQ will idle with the CQ aware
that that SQ is corked. Without doorbell buffers, at some point the
guest will process a CQE, ring a CQ doorbell, uncork the CQ, and we'll
nudge the parked SQ worker thread into operation again.
With doorbell buffers, if the event index matches the CQ tail we'll
never get a doorbell when the CQ has been drained. If the guest never
submits another I/O on the corked SQ, the pending I/O may never get
processed.
A more careful treatment would only have the event index lag if we are
at risk of having a worker thread defer an I/O because this CQ would be
full. This would look something like not letting EventIdx advance so far
forward that there is less than one entry available for each SQ pointed
at this CQ.
Eating the unnecessary doorbell cost at least gets doorbell buffers
correct in this case and we can turn it back on. The more careful
treatment of EventIdx can come later.1 parent ffcc27b commit e25e56e
1 file changed
Lines changed: 28 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
352 | 352 | | |
353 | | - | |
354 | | - | |
355 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
356 | 374 | | |
357 | | - | |
| 375 | + | |
358 | 376 | | |
359 | 377 | | |
360 | 378 | | |
| |||
0 commit comments