Commit 9623a040 authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

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: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: Ic4850d803a23413f9813da30ac6f1b611804f1b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5847


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 8a1a8450
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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: