Commit e2916ec1 authored by Jim Harris's avatar Jim Harris
Browse files

iscsi: add trace owner support



Note: spdk_trace_record() in the fuzzing app really shouldn't be
there, so this patch removes it.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I4b0dad56775beee3563d15786c4d0ccd41142997
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22892


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent f6ec2d71
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@ iscsi_conn_construct(struct spdk_iscsi_portal *portal,
	}

	conn->pg = pg;
	conn->trace_id = spdk_trace_register_owner(OWNER_TYPE_ISCSI_CONN, conn->initiator_addr);
	spdk_thread_send_msg(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(pg)),
			     iscsi_conn_start, conn);
	return 0;
@@ -1180,7 +1181,7 @@ iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
	struct spdk_iscsi_conn *conn = task->conn;
	struct spdk_iscsi_pdu *pdu = task->pdu;

	spdk_trace_record(TRACE_ISCSI_TASK_DONE, conn->id, 0, (uintptr_t)task);
	spdk_trace_record(TRACE_ISCSI_TASK_DONE, conn->trace_id, 0, (uintptr_t)task);

	task->is_queued = false;
	primary = iscsi_task_get_primary(task);
@@ -1191,7 +1192,7 @@ iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
		process_non_read_task_completion(conn, task, primary);
	}
	if (!task->parent) {
		spdk_trace_record(TRACE_ISCSI_PDU_COMPLETED, 0, 0, (uintptr_t)pdu);
		spdk_trace_record(TRACE_ISCSI_PDU_COMPLETED, conn->trace_id, 0, (uintptr_t)pdu);
	}
}

@@ -1289,7 +1290,7 @@ iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
	ret = spdk_sock_recv(conn->sock, buf, bytes);

	if (ret > 0) {
		spdk_trace_record(TRACE_ISCSI_READ_FROM_SOCKET_DONE, conn->id, ret, 0);
		spdk_trace_record(TRACE_ISCSI_READ_FROM_SOCKET_DONE, conn->trace_id, ret, 0);
		return ret;
	}

@@ -1330,7 +1331,7 @@ iscsi_conn_readv_data(struct spdk_iscsi_conn *conn,
	ret = spdk_sock_readv(conn->sock, iov, iovcnt);

	if (ret > 0) {
		spdk_trace_record(TRACE_ISCSI_READ_FROM_SOCKET_DONE, conn->id, ret, 0);
		spdk_trace_record(TRACE_ISCSI_READ_FROM_SOCKET_DONE, conn->trace_id, ret, 0);
		return ret;
	}

+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ struct spdk_iscsi_conn {
	int				login_phase;
	bool				is_logged_out;
	struct spdk_iscsi_pdu		*login_rsp_pdu;
	uint16_t			trace_id;

	uint64_t	last_flush;
	uint64_t	last_fill;
+9 −3
Original line number Diff line number Diff line
@@ -2088,6 +2088,12 @@ iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn,
		}

		conn->full_feature = 1;
		if (conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
			spdk_trace_owner_append_description(conn->trace_id, "discovery");
		} else {
			assert(conn->target != NULL);
			spdk_trace_owner_append_description(conn->trace_id, conn->target->name);
		}
		break;

	default:
@@ -3206,7 +3212,7 @@ iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn,
void
iscsi_queue_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task)
{
	spdk_trace_record(TRACE_ISCSI_TASK_QUEUE, conn->id, task->scsi.length,
	spdk_trace_record(TRACE_ISCSI_TASK_QUEUE, conn->trace_id, task->scsi.length,
			  (uintptr_t)task, (uintptr_t)task->pdu);
	task->is_queued = true;
	spdk_scsi_dev_queue_task(conn->dev, &task->scsi);
@@ -4838,7 +4844,7 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
			}

			/* All data for this PDU has now been read from the socket. */
			spdk_trace_record(TRACE_ISCSI_READ_PDU, conn->id, pdu->data_valid_bytes,
			spdk_trace_record(TRACE_ISCSI_READ_PDU, conn->trace_id, pdu->data_valid_bytes,
					  (uintptr_t)pdu, pdu->bhs.opcode);

			if (!pdu->is_rejected) {
@@ -4847,7 +4853,7 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
				rc = 0;
			}
			if (rc == 0) {
				spdk_trace_record(TRACE_ISCSI_TASK_EXECUTED, 0, 0, (uintptr_t)pdu);
				spdk_trace_record(TRACE_ISCSI_TASK_EXECUTED, conn->trace_id, 0, (uintptr_t)pdu);
				iscsi_put_pdu(pdu);
				conn->pdu_in_progress = NULL;
				conn->pdu_recv_state = ISCSI_PDU_RECV_STATE_AWAIT_PDU_READY;
+0 −4
Original line number Diff line number Diff line
@@ -473,10 +473,6 @@ iscsi_fuzz_read_pdu(struct spdk_iscsi_conn *conn)
				}
			}

			/* All data for this PDU has now been read from the socket. */
			spdk_trace_record(TRACE_ISCSI_READ_PDU, conn->id, pdu->data_valid_bytes,
					  (uintptr_t)pdu, pdu->bhs.opcode);

			if (!pdu->is_rejected) {
				rc = iscsi_fuzz_pdu_payload_handle(conn, pdu);
			} else {