|
|
@@ -664,13 +664,22 @@ static void handle_sc_creation(struct vmbus_channel *new_sc)
|
|
|
static void handle_multichannel_storage(struct hv_device *device, int max_chns)
|
|
|
{
|
|
|
struct storvsc_device *stor_device;
|
|
|
- int num_cpus = num_online_cpus();
|
|
|
int num_sc;
|
|
|
struct storvsc_cmd_request *request;
|
|
|
struct vstor_packet *vstor_packet;
|
|
|
int ret, t;
|
|
|
|
|
|
- num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns);
|
|
|
+ /*
|
|
|
+ * If the number of CPUs is artificially restricted, such as
|
|
|
+ * with maxcpus=1 on the kernel boot line, Hyper-V could offer
|
|
|
+ * sub-channels >= the number of CPUs. These sub-channels
|
|
|
+ * should not be created. The primary channel is already created
|
|
|
+ * and assigned to one CPU, so check against # CPUs - 1.
|
|
|
+ */
|
|
|
+ num_sc = min((int)(num_online_cpus() - 1), max_chns);
|
|
|
+ if (!num_sc)
|
|
|
+ return;
|
|
|
+
|
|
|
stor_device = get_out_stor_device(device);
|
|
|
if (!stor_device)
|
|
|
return;
|