Commit 17199cdc authored by John Levon's avatar John Levon Committed by Tomasz Zawadzki
Browse files

add name to fd groups



For debugging purposes, take a name for identifying fds added to a group.

Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: If1654e56e19f7fa964446ef1b9e71debf74979d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9731


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 2d48b7dc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ Added `spdk_nvme_ctrlr_get_opts` to retrieve the current controller options.

Updated DPDK submodule to DPDK 21.08.

### util

The `spdk_fd_group_add` API now takes a `name` parameter.

## v21.07

### accel_fw
+10 −2
Original line number Diff line number Diff line
@@ -110,11 +110,19 @@ int spdk_fd_group_get_fd(struct spdk_fd_group *fgrp);
 * \param efd File descriptor of the event source.
 * \param fn Called each time there are events in event source.
 * \param arg Function argument for fn.
 * \param name Name of the event source.
 *
 * \return 0 if success or -errno if failed
 */
int spdk_fd_group_add(struct spdk_fd_group *fgrp,
		      int efd, spdk_fd_fn fn, void *arg);
int spdk_fd_group_add(struct spdk_fd_group *fgrp, int efd,
		      spdk_fd_fn fn, void *arg, const char *name);

/*
 * \brief Register an event source with the name set to the string of the
 * callback function.
 */
#define SPDK_FD_GROUP_ADD(fgrp, efd, fn, arg) \
	spdk_fd_group_add(fgrp, efd, fn, arg, #fn)

/**
 * Unregister one event source from one fgrp.
+4 −3
Original line number Diff line number Diff line
@@ -1150,7 +1150,8 @@ _schedule_thread(void *arg1, void *arg2)
		int rc;

		efd = spdk_thread_get_interrupt_fd(thread);
		rc = spdk_fd_group_add(reactor->fgrp, efd, thread_process_interrupts, thread);
		rc = SPDK_FD_GROUP_ADD(reactor->fgrp, efd,
				       thread_process_interrupts, thread);
		if (rc < 0) {
			SPDK_ERRLOG("Failed to schedule spdk_thread: %s.\n", spdk_strerror(-rc));
		}
@@ -1413,7 +1414,7 @@ reactor_interrupt_init(struct spdk_reactor *reactor)
		goto err;
	}

	rc = spdk_fd_group_add(reactor->fgrp, reactor->resched_fd, reactor_schedule_thread_event,
	rc = SPDK_FD_GROUP_ADD(reactor->fgrp, reactor->resched_fd, reactor_schedule_thread_event,
			       reactor);
	if (rc) {
		close(reactor->resched_fd);
@@ -1429,7 +1430,7 @@ reactor_interrupt_init(struct spdk_reactor *reactor)
		goto err;
	}

	rc = spdk_fd_group_add(reactor->fgrp, reactor->events_fd,
	rc = SPDK_FD_GROUP_ADD(reactor->fgrp, reactor->events_fd,
			       event_queue_run_batch, reactor);
	if (rc) {
		spdk_fd_group_remove(reactor->fgrp, reactor->resched_fd);
+6 −5
Original line number Diff line number Diff line
@@ -1263,8 +1263,7 @@ period_poller_interrupt_init(struct spdk_poller *poller)
		return -errno;
	}

	rc = spdk_fd_group_add(fgrp, timerfd,
			       interrupt_timerfd_process, poller);
	rc = SPDK_FD_GROUP_ADD(fgrp, timerfd, interrupt_timerfd_process, poller);
	if (rc < 0) {
		close(timerfd);
		return rc;
@@ -1352,7 +1351,8 @@ busy_poller_interrupt_init(struct spdk_poller *poller)
		return -errno;
	}

	rc = spdk_fd_group_add(poller->thread->fgrp, busy_efd, poller->fn, poller->arg);
	rc = spdk_fd_group_add(poller->thread->fgrp, busy_efd,
			       poller->fn, poller->arg, poller->name);
	if (rc < 0) {
		close(busy_efd);
		return rc;
@@ -2487,7 +2487,8 @@ thread_interrupt_create(struct spdk_thread *thread)
		return rc;
	}

	return spdk_fd_group_add(thread->fgrp, thread->msg_fd, thread_interrupt_msg_process, thread);
	return SPDK_FD_GROUP_ADD(thread->fgrp, thread->msg_fd,
				 thread_interrupt_msg_process, thread);
}
#else
static int
@@ -2516,7 +2517,7 @@ spdk_interrupt_register(int efd, spdk_interrupt_fn fn,
		return NULL;
	}

	ret = spdk_fd_group_add(thread->fgrp, efd, fn, arg);
	ret = spdk_fd_group_add(thread->fgrp, efd, fn, arg, name);

	if (ret != 0) {
		SPDK_ERRLOG("thread %s: failed to add fd %d: %s\n",
+2 −2
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 3
SO_MINOR := 1
SO_VER := 4
SO_MINOR := 0

C_SRCS = base64.c bit_array.c cpuset.c crc16.c crc32.c crc32c.c crc32_ieee.c \
	 dif.c fd.c file.c iov.c math.c pipe.c strerror_tls.c string.c uuid.c \
Loading