idxd: perf optimization, remove reg read

In the completion handler there's no need to do an MMIO read
unless the completion record indicates there's an error.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic4850d803a23413f9813da30ac6f1b611804f1b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5847
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
paul luse 2021-01-10 10:51:49 -05:00 committed by Tomasz Zawadzki
parent 8a1a845053
commit 9623a0402b

View File

@ -37,6 +37,7 @@
#include "spdk/env.h"
#include "spdk/util.h"
#include "spdk/memory.h"
#include "spdk/likely.h"
#include "spdk/log.h"
#include "spdk_internal/idxd.h"
@ -1385,6 +1386,9 @@ _dump_error_reg(struct spdk_idxd_io_channel *chan)
* needs to look at each array bit to know whether it should even check that completion record. That may be
* faster though, need to experiment.
*/
#define IDXD_COMPLETION(x) ((x) > (0) ? (1) : (0))
#define IDXD_FAILURE(x) ((x) > (1) ? (1) : (0))
#define IDXD_SW_ERROR(x) ((x) &= (0x1) ? (1) : (0))
void
spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
{
@ -1393,14 +1397,17 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
int status = 0;
TAILQ_FOREACH_SAFE(comp_ctx, &chan->comp_ctx_oustanding, link, tmp) {
if (comp_ctx->hw.status == 1) {
if (IDXD_COMPLETION(comp_ctx->hw.status)) {
TAILQ_REMOVE(&chan->comp_ctx_oustanding, comp_ctx, link);
if (spdk_unlikely(IDXD_FAILURE(comp_ctx->hw.status))) {
sw_error_0 = _idxd_read_8(chan->idxd, IDXD_SWERR_OFFSET);
if (sw_error_0 & 0x1) {
if (IDXD_SW_ERROR(sw_error_0)) {
_dump_error_reg(chan);
status = -EINVAL;
}
}
switch (comp_ctx->desc->opcode) {
case IDXD_OPCODE_BATCH: