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 <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/392446
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-20 10:01:58 +09:00 committed by Jim Harris
parent 0241b85bc1
commit b65443be6e

View File

@ -302,9 +302,8 @@ spdk_iscsi_portal_create_from_configline(const char *portalstring,
SPDK_ERRLOG("invalid portal cpumask %s\n", cpumask_str); SPDK_ERRLOG("invalid portal cpumask %s\n", cpumask_str);
goto error_out; goto error_out;
} }
if ((cpumask & spdk_app_get_core_mask()) != cpumask) { if (cpumask == 0) {
SPDK_ERRLOG("portal cpumask %s not a subset of " SPDK_ERRLOG("no cpu is selected among reactor mask(=%jx)\n",
"reactor mask %jx\n", cpumask_str,
spdk_app_get_core_mask()); spdk_app_get_core_mask());
goto error_out; goto error_out;
} }