From b65443be6ea86dd752d81c897af2e14b2eee293c Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 20 Dec 2017 10:01:58 +0900 Subject: [PATCH] iscsi: Allow to set cpumask more than active cores for iSCSI connection Currently the cpumask must be a subset of the reactor mask. However, this is different from sched_setaffinity() function and taskset command of FreeBSD and Linux. The latter will be familier for more people. Hence the later is adopted. The following is quoted from the FreeBSD Man Page of taskset: The CPU affinity is represented as a bitmask, with the lowest order bit corresponding to the first logical CPU and the highest order bit corresponding to the last logical CPU. Not all CPUs may exist on a given system but a mask may specify more CPUs than are present. A retrieved mask will reflect only the bits that correspond to CPUs physically on the system. If an invalid mask is given (i.e., one that corresponds to no valid CPUs on the current system) an error is returned. The masks are typically given in hexadecimal. Change-Id: I7e0d2e029569bfc986f7fcdf78048791ab389f72 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/392446 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/portal_grp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/iscsi/portal_grp.c b/lib/iscsi/portal_grp.c index 5aef41355..d5b22f8fd 100644 --- a/lib/iscsi/portal_grp.c +++ b/lib/iscsi/portal_grp.c @@ -302,9 +302,8 @@ spdk_iscsi_portal_create_from_configline(const char *portalstring, SPDK_ERRLOG("invalid portal cpumask %s\n", cpumask_str); goto error_out; } - if ((cpumask & spdk_app_get_core_mask()) != cpumask) { - SPDK_ERRLOG("portal cpumask %s not a subset of " - "reactor mask %jx\n", cpumask_str, + if (cpumask == 0) { + SPDK_ERRLOG("no cpu is selected among reactor mask(=%jx)\n", spdk_app_get_core_mask()); goto error_out; }