From 23bba4b51cd8cfd346a72004221300ec50fc7ae6 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 7 Jun 2016 22:30:00 -0700 Subject: [PATCH] nvme - Add interrupt coalescing support * Add interrupt coalescing support. However, disable it in the code for now by setting its parameters to 0. I tried minimal parameters (time set to 1 which is 100uS and aggregation threshold set to 4) and it completely destroyed performance in all my tests on the Intel 750. Even in tests where the interrupt rate was less than 10,000/sec, the intel controller is clearly implementing a broken algorithm and is actually enforcing that 100uS of latency even if the interrupt rate has not exceeded the rate. So even relatively large transfers had horrible performance. So for now the code is in, but its turned off. --- sys/dev/disk/nvme/nvme_admin.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sys/dev/disk/nvme/nvme_admin.c b/sys/dev/disk/nvme/nvme_admin.c index 43027ffde5..96e19d3cb7 100644 --- a/sys/dev/disk/nvme/nvme_admin.c +++ b/sys/dev/disk/nvme/nvme_admin.c @@ -439,6 +439,31 @@ nvme_admin_state_make_queues(nvme_softc_t *sc) sc->admin_func = nvme_admin_state_identify_ns; } + /* + * Basically interrupt coalescing is worthless if we care about + * performance, at least on the Intel 750. Setting the threshold + * has no effect if time is set to 0. The smallest time that can + * be set is a value of 1 (== 100uS), which is much too long. That + * is only 10,000 interrupts/sec/cpu and on the Intel 750 it totally + * destroys sequential performance. + */ + req = nvme_get_admin_request(sc, NVME_OP_SET_FEATURES); + + device_printf(sc->dev, "Interrupt Coalesce: 100uS / 4 qentries\n"); + + req->cmd.setfeat.flags = NVME_FID_INTCOALESCE; + req->cmd.setfeat.intcoal.thr = 0; + req->cmd.setfeat.intcoal.time = 0; + + nvme_submit_request(req); + status = nvme_wait_request(req); + if (status) { + device_printf(sc->dev, + "Interrupt coalesce failed status=%d\n", + status); + } + nvme_put_request(req); + return 1; } -- 2.11.4.GIT