Skip to content

Commit

Permalink
scsi: ibmvfc: Limit max hw queues by num_online_cpus()
Browse files Browse the repository at this point in the history
An LPAR could potentially be configured with a small logical cpu count that
is less then the default hardware queue max. Ensure that we don't allocate
more hw queues than available cpus.

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Link: https://lore.kernel.org/r/20230921225435.3537728-4-tyreld@linux.ibm.com
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Tyrel Datwyler authored and Martin K. Petersen committed Sep 22, 2023
1 parent e1a4e0d commit b27bce7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/scsi/ibmvscsi/ibmvfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6261,7 +6261,8 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
struct Scsi_Host *shost;
struct device *dev = &vdev->dev;
int rc = -ENOMEM;
unsigned int max_scsi_queues = IBMVFC_MAX_SCSI_QUEUES;
unsigned int online_cpus = num_online_cpus();
unsigned int max_scsi_queues = min((unsigned int)IBMVFC_MAX_SCSI_QUEUES, online_cpus);

ENTER;
shost = scsi_host_alloc(&driver_template, sizeof(*vhost));
Expand Down

0 comments on commit b27bce7

Please sign in to comment.