Commit 25270f1d authored by Ben Walker's avatar Ben Walker Committed by Daniel Verkamp
Browse files

Rename instance_id to shm_id and make it default to pid



By default, all SPDK applications will not share memory.
To share memory, start the applications with the same
shared memory id.

Change-Id: Ib6180369ef0ed12d05983a21d7943e467402b21a
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 26c8e7cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ usage(char *executable_name)
	printf(" -c config  config file (default %s)\n", SPDK_ISCSI_DEFAULT_CONFIG);
	printf(" -e mask    tracepoint group mask for spdk trace buffers (default 0x0)\n");
	printf(" -m mask    core mask for DPDK\n");
	printf(" -i instance ID\n");
	printf(" -i shared memory ID (optional)\n");
	printf(" -l facility use specific syslog facility (default %s)\n",
	       opts.log_facility);
	printf(" -n channel number of memory channels used for DPDK\n");
@@ -116,7 +116,7 @@ main(int argc, char **argv)
			opts.config_file = optarg;
			break;
		case 'i':
			opts.instance_id = atoi(optarg);
			opts.shm_id = atoi(optarg);
			break;
		case 'l':
			opts.log_facility = optarg;
+6 −6
Original line number Diff line number Diff line
@@ -54,14 +54,14 @@ extern "C" {
}

static char *exe_name;
static int g_instance_id = 0;
static int g_shm_id = 0;

static void usage(void)
{
	fprintf(stderr, "usage:\n");
	fprintf(stderr, "   %s <option>\n", exe_name);
	fprintf(stderr, "        option = '-i' to specify the instance ID,"
		" (default: 0)\n");
	fprintf(stderr, "        option = '-i' to specify the shared memory ID,"
		" (required)\n");
}

static bool
@@ -90,7 +90,7 @@ print_connections(void)
	int			fd, i;
	char			shm_name[64];

	sprintf(shm_name, "spdk_iscsi_conns.%d", g_instance_id);
	sprintf(shm_name, "spdk_iscsi_conns.%d", g_shm_id);
	fd = shm_open(shm_name, O_RDONLY, 0600);
	if (fd < 0) {
		fprintf(stderr, "Cannot open shared memory: %s\n", shm_name);
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
	while ((op = getopt(argc, argv, "i:")) != -1) {
		switch (op) {
		case 'i':
			g_instance_id = atoi(optarg);
			g_shm_id = atoi(optarg);
			break;
		default:
			usage();
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
		}
	}

	sprintf(spdk_trace_shm_name, "/iscsi_trace.%d", g_instance_id);
	sprintf(spdk_trace_shm_name, "/iscsi_trace.%d", g_shm_id);
	history_fd = shm_open(spdk_trace_shm_name, O_RDONLY, 0600);
	if (history_fd < 0) {
		fprintf(stderr, "Unable to open history shm %s\n", spdk_trace_shm_name);
+2 −2
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ usage(void)
	printf(" -c config  - config file (default %s)\n", SPDK_NVMF_DEFAULT_CONFIG);
	printf(" -e mask    - tracepoint group mask for spdk trace buffers (default 0x0)\n");
	printf(" -m mask    - core mask for DPDK\n");
	printf(" -i instance ID\n");
	printf(" -i shared memory ID (optional)\n");
	printf(" -l facility - use specific syslog facility (default %s)\n",
	       opts.log_facility);
	printf(" -n channel number of memory channels used for DPDK\n");
@@ -408,7 +408,7 @@ main(int argc, char **argv)
			opts.config_file = optarg;
			break;
		case 'i':
			opts.instance_id = atoi(optarg);
			opts.shm_id = atoi(optarg);
			break;
		case 'l':
			opts.log_facility = optarg;
+4 −4
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ struct object_stats g_stats[SPDK_TRACE_MAX_OBJECT];

static char *exe_name;
static int verbose = 1;
static int g_instance_id = 0;
static int g_shm_id = 0;
static int g_fudge_factor = 20;

static uint64_t tsc_rate;
@@ -306,7 +306,7 @@ static void usage(void)
	fprintf(stderr, "                 '-c' to display single lcore history\n");
	fprintf(stderr, "                 '-f' to specify number of events to ignore at\n");
	fprintf(stderr, "                      beginning and end of trace (default: 20)\n");
	fprintf(stderr, "                 '-i' to specify the instance ID, (default: 0)\n");
	fprintf(stderr, "                 '-i' to specify the shared memory ID, (required)\n");
}

int main(int argc, char **argv)
@@ -336,7 +336,7 @@ int main(int argc, char **argv)
			g_fudge_factor = atoi(optarg);
			break;
		case 'i':
			g_instance_id = atoi(optarg);
			g_shm_id = atoi(optarg);
			break;
		case 'q':
			verbose = 0;
@@ -350,7 +350,7 @@ int main(int argc, char **argv)
		}
	}

	snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", app_name, g_instance_id);
	snprintf(shm_name, sizeof(shm_name), "/%s_trace.%d", app_name, g_shm_id);
	fd = shm_open(shm_name, O_RDONLY, 0600);
	if (fd < 0) {
		fprintf(stderr, "Could not open shm %s.\n", shm_name);
+3 −3
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@
# Bracketed ([]) names define sections

[Global]
  # Instance ID for multi-process support
  # Default: 0
  #InstanceID 0
  # Shared Memory Group ID. SPDK applications with the same ID will share memory.
  # Default: <the process PID>
  #SharedMemoryID 0

  # Users can restrict work items to only run on certain cores by
  #  specifying a ReactorMask.  Default is to allow work items to run
Loading