public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] small pm80xx driver fixes
@ 2024-06-27 15:59 TJ Adams
  2024-06-27 15:59 ` [PATCH v2 1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it TJ Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: TJ Adams @ 2024-06-27 15:59 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv, TJ Adams

These are 2 small patches to prevent a kernel crash and change some
logs' levels. V1 consisted of 3 patches. One patch is being dropped so
it can be reworked and sent separately.

Igor Pylypiv (1):
  scsi: pm80xx: Set phy->enable_completion only when we wait for it

Terrence Adams (1):
  scsi: pm8001: Update log level when reading config table

 drivers/scsi/pm8001/pm8001_sas.c | 4 +++-
 drivers/scsi/pm8001/pm80xx_hwi.c | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

-- 
2.45.2.741.gdbec12cfda-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it
  2024-06-27 15:59 [PATCH v2 0/2] small pm80xx driver fixes TJ Adams
@ 2024-06-27 15:59 ` TJ Adams
  2024-06-27 15:59 ` [PATCH v2 2/2] scsi: pm8001: Update log level when reading config table TJ Adams
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: TJ Adams @ 2024-06-27 15:59 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv, Terrence Adams, Jack Wang

From: Igor Pylypiv <ipylypiv@google.com>

pm8001_phy_control() populates the enable_completion pointer with a
stack address, sends a PHY_LINK_RESET / PHY_HARD_RESET, waits 300 ms,
and returns. The problem arises when a phy control response comes late.
After 300 ms the pm8001_phy_control() function returns and the passed
enable_completion stack address is no longer valid. Late phy control
response invokes complete() on a dangling enable_completion pointer
which leads to a kernel crash.

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Terrence Adams <tadamsjr@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index a5a31dfa4512..ee2da8e49d4c 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -166,7 +166,6 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 	unsigned long flags;
 	pm8001_ha = sas_phy->ha->lldd_ha;
 	phy = &pm8001_ha->phy[phy_id];
-	pm8001_ha->phy[phy_id].enable_completion = &completion;
 
 	if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
 		/*
@@ -190,6 +189,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 				rates->maximum_linkrate;
 		}
 		if (pm8001_ha->phy[phy_id].phy_state ==  PHY_LINK_DISABLE) {
+			pm8001_ha->phy[phy_id].enable_completion = &completion;
 			PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id);
 			wait_for_completion(&completion);
 		}
@@ -198,6 +198,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 		break;
 	case PHY_FUNC_HARD_RESET:
 		if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) {
+			pm8001_ha->phy[phy_id].enable_completion = &completion;
 			PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id);
 			wait_for_completion(&completion);
 		}
@@ -206,6 +207,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 		break;
 	case PHY_FUNC_LINK_RESET:
 		if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) {
+			pm8001_ha->phy[phy_id].enable_completion = &completion;
 			PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id);
 			wait_for_completion(&completion);
 		}
-- 
2.45.2.741.gdbec12cfda-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] scsi: pm8001: Update log level when reading config table
  2024-06-27 15:59 [PATCH v2 0/2] small pm80xx driver fixes TJ Adams
  2024-06-27 15:59 ` [PATCH v2 1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it TJ Adams
@ 2024-06-27 15:59 ` TJ Adams
  2024-07-05  2:53 ` [PATCH v2 0/2] small pm80xx driver fixes Martin K. Petersen
  2024-07-11  3:08 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: TJ Adams @ 2024-06-27 15:59 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-kernel, Igor Pylypiv, Terrence Adams, Jack Wang

From: Terrence Adams <tadamsjr@google.com>

Reading the main config table occurs as a part of initialization in
pm80xx_chip_init(). Because of this it makes more sense to have it be a
part of the INIT logging.

Signed-off-by: Terrence Adams <tadamsjr@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index a52ae6841939..8fe886dc5e47 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -568,13 +568,13 @@ static void read_main_config_table(struct pm8001_hba_info *pm8001_ha)
 	pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version =
 		pm8001_mr32(address, MAIN_MPI_INACTIVE_FW_VERSION);
 
-	pm8001_dbg(pm8001_ha, DEV,
+	pm8001_dbg(pm8001_ha, INIT,
 		   "Main cfg table: sign:%x interface rev:%x fw_rev:%x\n",
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.signature,
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev,
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev);
 
-	pm8001_dbg(pm8001_ha, DEV,
+	pm8001_dbg(pm8001_ha, INIT,
 		   "table offset: gst:%x iq:%x oq:%x int vec:%x phy attr:%x\n",
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.gst_offset,
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.inbound_queue_offset,
@@ -582,7 +582,7 @@ static void read_main_config_table(struct pm8001_hba_info *pm8001_ha)
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.int_vec_table_offset,
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.phy_attr_table_offset);
 
-	pm8001_dbg(pm8001_ha, DEV,
+	pm8001_dbg(pm8001_ha, INIT,
 		   "Main cfg table; ila rev:%x Inactive fw rev:%x\n",
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version,
 		   pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version);
-- 
2.45.2.741.gdbec12cfda-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] small pm80xx driver fixes
  2024-06-27 15:59 [PATCH v2 0/2] small pm80xx driver fixes TJ Adams
  2024-06-27 15:59 ` [PATCH v2 1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it TJ Adams
  2024-06-27 15:59 ` [PATCH v2 2/2] scsi: pm8001: Update log level when reading config table TJ Adams
@ 2024-07-05  2:53 ` Martin K. Petersen
  2024-07-11  3:08 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-07-05  2:53 UTC (permalink / raw)
  To: TJ Adams
  Cc: Jack Wang, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi, linux-kernel, Igor Pylypiv


TJ,

> These are 2 small patches to prevent a kernel crash and change some
> logs' levels. V1 consisted of 3 patches. One patch is being dropped so
> it can be reworked and sent separately.

Applied to 6.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] small pm80xx driver fixes
  2024-06-27 15:59 [PATCH v2 0/2] small pm80xx driver fixes TJ Adams
                   ` (2 preceding siblings ...)
  2024-07-05  2:53 ` [PATCH v2 0/2] small pm80xx driver fixes Martin K. Petersen
@ 2024-07-11  3:08 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-07-11  3:08 UTC (permalink / raw)
  To: Jack Wang, James E . J . Bottomley, TJ Adams
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, Igor Pylypiv

On Thu, 27 Jun 2024 15:59:22 +0000, TJ Adams wrote:

> These are 2 small patches to prevent a kernel crash and change some
> logs' levels. V1 consisted of 3 patches. One patch is being dropped so
> it can be reworked and sent separately.
> 
> Igor Pylypiv (1):
>   scsi: pm80xx: Set phy->enable_completion only when we wait for it
> 
> [...]

Applied to 6.11/scsi-queue, thanks!

[1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it
      https://git.kernel.org/mkp/scsi/c/e4f949ef1516
[2/2] scsi: pm8001: Update log level when reading config table
      https://git.kernel.org/mkp/scsi/c/76a20140ef76

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-11  3:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 15:59 [PATCH v2 0/2] small pm80xx driver fixes TJ Adams
2024-06-27 15:59 ` [PATCH v2 1/2] scsi: pm80xx: Set phy->enable_completion only when we wait for it TJ Adams
2024-06-27 15:59 ` [PATCH v2 2/2] scsi: pm8001: Update log level when reading config table TJ Adams
2024-07-05  2:53 ` [PATCH v2 0/2] small pm80xx driver fixes Martin K. Petersen
2024-07-11  3:08 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox