Message ID | 20241004093140.149951-1-ranjan.kumar@broadcom.com |
---|---|
State | Superseded |
Headers | show |
Series | [v1] mpi3mr: Validating SAS port assignments | expand |
Hi Ranjan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.12-rc1 next-20241004]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-Validating-SAS-port-assignments/20241004-173719
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link: https://lore.kernel.org/r/20241004093140.149951-1-ranjan.kumar%40broadcom.com
patch subject: [PATCH v1] mpi3mr: Validating SAS port assignments
config: x86_64-buildonly-randconfig-004-20241005 (https://download.01.org/0day-ci/archive/20241005/202410051943.Mp9o5DlF-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410051943.Mp9o5DlF-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410051943.Mp9o5DlF-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/scsi/mpi3mr/mpi3mr_transport.c:599: warning: Function parameter or struct member 'host_node' not described in 'mpi3mr_delete_sas_phy'
drivers/scsi/mpi3mr/mpi3mr_transport.c:1046: warning: Function parameter or struct member 'port_id' not described in 'mpi3mr_get_hba_port_by_id'
vim +599 drivers/scsi/mpi3mr/mpi3mr_transport.c
fc7212fd310092 Sreekanth Reddy 2022-08-04 587
fc7212fd310092 Sreekanth Reddy 2022-08-04 588 /**
fc7212fd310092 Sreekanth Reddy 2022-08-04 589 * mpi3mr_delete_sas_phy - Remove a single phy from port
fc7212fd310092 Sreekanth Reddy 2022-08-04 590 * @mrioc: Adapter instance reference
fc7212fd310092 Sreekanth Reddy 2022-08-04 591 * @mr_sas_port: Internal Port object
fc7212fd310092 Sreekanth Reddy 2022-08-04 592 * @mr_sas_phy: Internal Phy object
fc7212fd310092 Sreekanth Reddy 2022-08-04 593 *
fc7212fd310092 Sreekanth Reddy 2022-08-04 594 * Return: None.
fc7212fd310092 Sreekanth Reddy 2022-08-04 595 */
fc7212fd310092 Sreekanth Reddy 2022-08-04 596 static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
fc7212fd310092 Sreekanth Reddy 2022-08-04 597 struct mpi3mr_sas_port *mr_sas_port,
d909d8da87f441 Ranjan Kumar 2024-10-04 598 struct mpi3mr_sas_phy *mr_sas_phy, u8 host_node)
fc7212fd310092 Sreekanth Reddy 2022-08-04 @599 {
fc7212fd310092 Sreekanth Reddy 2022-08-04 600 u64 sas_address = mr_sas_port->remote_identify.sas_address;
fc7212fd310092 Sreekanth Reddy 2022-08-04 601
fc7212fd310092 Sreekanth Reddy 2022-08-04 602 dev_info(&mr_sas_phy->phy->dev,
fc7212fd310092 Sreekanth Reddy 2022-08-04 603 "remove: sas_address(0x%016llx), phy(%d)\n",
fc7212fd310092 Sreekanth Reddy 2022-08-04 604 (unsigned long long) sas_address, mr_sas_phy->phy_id);
fc7212fd310092 Sreekanth Reddy 2022-08-04 605
fc7212fd310092 Sreekanth Reddy 2022-08-04 606 list_del(&mr_sas_phy->port_siblings);
fc7212fd310092 Sreekanth Reddy 2022-08-04 607 mr_sas_port->num_phys--;
d909d8da87f441 Ranjan Kumar 2024-10-04 608
d909d8da87f441 Ranjan Kumar 2024-10-04 609 if (host_node) {
2745ce0e6d30e6 Sreekanth Reddy 2022-08-04 610 mr_sas_port->phy_mask &= ~(1 << mr_sas_phy->phy_id);
d909d8da87f441 Ranjan Kumar 2024-10-04 611
2745ce0e6d30e6 Sreekanth Reddy 2022-08-04 612 if (mr_sas_port->lowest_phy == mr_sas_phy->phy_id)
2745ce0e6d30e6 Sreekanth Reddy 2022-08-04 613 mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
d909d8da87f441 Ranjan Kumar 2024-10-04 614 }
fc7212fd310092 Sreekanth Reddy 2022-08-04 615 sas_port_delete_phy(mr_sas_port->port, mr_sas_phy->phy);
fc7212fd310092 Sreekanth Reddy 2022-08-04 616 mr_sas_phy->phy_belongs_to_port = 0;
fc7212fd310092 Sreekanth Reddy 2022-08-04 617 }
fc7212fd310092 Sreekanth Reddy 2022-08-04 618
diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index dc2cdd5f0311..3822efe349e1 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -541,8 +541,8 @@ struct mpi3mr_hba_port { * @port_list: List of ports belonging to a SAS node * @num_phys: Number of phys associated with port * @marked_responding: used while refresing the sas ports - * @lowest_phy: lowest phy ID of current sas port - * @phy_mask: phy_mask of current sas port + * @lowest_phy: lowest phy ID of current sas port, valid for controller port + * @phy_mask: phy_mask of current sas port, valid for controller port * @hba_port: HBA port entry * @remote_identify: Attached device identification * @rphy: SAS transport layer rphy object diff --git a/drivers/scsi/mpi3mr/mpi3mr_transport.c b/drivers/scsi/mpi3mr/mpi3mr_transport.c index ccd23def2e0c..3a685750f5cd 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_transport.c +++ b/drivers/scsi/mpi3mr/mpi3mr_transport.c @@ -595,7 +595,7 @@ static enum sas_linkrate mpi3mr_convert_phy_link_rate(u8 link_rate) */ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc, struct mpi3mr_sas_port *mr_sas_port, - struct mpi3mr_sas_phy *mr_sas_phy) + struct mpi3mr_sas_phy *mr_sas_phy, u8 host_node) { u64 sas_address = mr_sas_port->remote_identify.sas_address; @@ -605,9 +605,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc, list_del(&mr_sas_phy->port_siblings); mr_sas_port->num_phys--; - mr_sas_port->phy_mask &= ~(1 << mr_sas_phy->phy_id); - if (mr_sas_port->lowest_phy == mr_sas_phy->phy_id) - mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; + + if (host_node) { + mr_sas_port->phy_mask &= ~(1 << mr_sas_phy->phy_id); + + if (mr_sas_port->lowest_phy == mr_sas_phy->phy_id) + mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; + } sas_port_delete_phy(mr_sas_port->port, mr_sas_phy->phy); mr_sas_phy->phy_belongs_to_port = 0; } @@ -617,12 +621,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc, * @mrioc: Adapter instance reference * @mr_sas_port: Internal Port object * @mr_sas_phy: Internal Phy object + * @host_node: Flag to indicate this is a host_node * * Return: None. */ static void mpi3mr_add_sas_phy(struct mpi3mr_ioc *mrioc, struct mpi3mr_sas_port *mr_sas_port, - struct mpi3mr_sas_phy *mr_sas_phy) + struct mpi3mr_sas_phy *mr_sas_phy, u8 host_node) { u64 sas_address = mr_sas_port->remote_identify.sas_address; @@ -632,9 +637,12 @@ static void mpi3mr_add_sas_phy(struct mpi3mr_ioc *mrioc, list_add_tail(&mr_sas_phy->port_siblings, &mr_sas_port->phy_list); mr_sas_port->num_phys++; - mr_sas_port->phy_mask |= (1 << mr_sas_phy->phy_id); - if (mr_sas_phy->phy_id < mr_sas_port->lowest_phy) - mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; + if (host_node) { + mr_sas_port->phy_mask |= (1 << mr_sas_phy->phy_id); + + if (mr_sas_phy->phy_id < mr_sas_port->lowest_phy) + mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; + } sas_port_add_phy(mr_sas_port->port, mr_sas_phy->phy); mr_sas_phy->phy_belongs_to_port = 1; } @@ -675,7 +683,7 @@ static void mpi3mr_add_phy_to_an_existing_port(struct mpi3mr_ioc *mrioc, if (srch_phy == mr_sas_phy) return; } - mpi3mr_add_sas_phy(mrioc, mr_sas_port, mr_sas_phy); + mpi3mr_add_sas_phy(mrioc, mr_sas_port, mr_sas_phy, mr_sas_node->host_node); return; } } @@ -736,7 +744,7 @@ static void mpi3mr_del_phy_from_an_existing_port(struct mpi3mr_ioc *mrioc, mpi3mr_delete_sas_port(mrioc, mr_sas_port); else mpi3mr_delete_sas_phy(mrioc, mr_sas_port, - mr_sas_phy); + mr_sas_phy, mr_sas_node->host_node); return; } } @@ -1367,7 +1375,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc, mpi3mr_sas_port_sanity_check(mrioc, mr_sas_node, mr_sas_port->remote_identify.sas_address, hba_port); - if (mr_sas_node->num_phys >= sizeof(mr_sas_port->phy_mask) * 8) + if (mr_sas_node->host_node && mr_sas_node->num_phys >= + sizeof(mr_sas_port->phy_mask) * 8) ioc_info(mrioc, "max port count %u could be too high\n", mr_sas_node->num_phys); @@ -1377,7 +1386,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc, (mr_sas_node->phy[i].hba_port != hba_port)) continue; - if (i >= sizeof(mr_sas_port->phy_mask) * 8) { + if (mr_sas_node->host_node && (i >= sizeof(mr_sas_port->phy_mask) * 8)) { ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n", i, sizeof(mr_sas_port->phy_mask) * 8); goto out_fail; @@ -1385,7 +1394,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc, list_add_tail(&mr_sas_node->phy[i].port_siblings, &mr_sas_port->phy_list); mr_sas_port->num_phys++; - mr_sas_port->phy_mask |= (1 << i); + if (mr_sas_node->host_node) + mr_sas_port->phy_mask |= (1 << i); } if (!mr_sas_port->num_phys) { @@ -1394,7 +1404,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc, goto out_fail; } - mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; + if (mr_sas_node->host_node) + mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1; if (mr_sas_port->remote_identify.device_type == SAS_END_DEVICE) { tgtdev = mpi3mr_get_tgtdev_by_addr(mrioc,
Sanity on phy_mask was added by Tomas through [1]. It causes warning messages when >64 phys are detected (expander can have >64 phys) and devices connected to phys greater than 64 are dropped. phy_mask bitmap is only needed for controller phys(not required for expander phys).Controller phys can go maximum up to 64 and u64 is good enough to contain phy_mask bitmap. To suppress those warnings and allow devices to be discovered as before the [1], restrict the phy_mask setting and lowest phy setting only to the controller phys. [1]:https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/ drivers/scsi/mpi3mr?h=6.12/ scsi-queue&id=3668651def2c1622904e58b0280ee93121f2b10b Fixes: 3668651def2c ("mpi3mr: Sanitise num_phys") Cc: stable@vger.kernel.org Reported-by: Alexander Motin <mav@ixsystems.com> Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com> --- drivers/scsi/mpi3mr/mpi3mr.h | 4 +-- drivers/scsi/mpi3mr/mpi3mr_transport.c | 39 +++++++++++++++++--------- 2 files changed, 27 insertions(+), 16 deletions(-)