]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
drop scsi-ufs-core-initialize-devfreq-synchronously.patch from everywhere
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 08:30:24 +0000 (10:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 08:30:24 +0000 (10:30 +0200)
queue-5.15/scsi-ufs-core-add-soft-dependency-on-governor_simple.patch
queue-5.15/scsi-ufs-core-initialize-devfreq-synchronously.patch [deleted file]
queue-5.15/series
queue-6.1/btrfs-zoned-fix-btrfs_can_activate_zone-to-support-dup-profile.patch
queue-6.1/scsi-ufs-core-add-soft-dependency-on-governor_simple.patch
queue-6.1/scsi-ufs-core-initialize-devfreq-synchronously.patch [deleted file]
queue-6.1/series
queue-6.2/scsi-ufs-core-add-soft-dependency-on-governor_simple.patch
queue-6.2/scsi-ufs-core-initialize-devfreq-synchronously.patch [deleted file]
queue-6.2/series

index c9fb691c410abbf806511fbb989eb0d62b8e4d31..ea18840112ecb9558b15a9765baf06a8883135ee 100644 (file)
@@ -17,20 +17,15 @@ Signed-off-by: Adrien Thierry <athierry@redhat.com>
 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/scsi/ufs/ufshcd.c | 1 +
+ drivers/scsi/ufs/ufshcd.c |    1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
-index eaa91aec036b1..fd430d24f6de9 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
-@@ -9749,5 +9749,6 @@ module_exit(ufshcd_core_exit);
+@@ -9734,5 +9734,6 @@ module_exit(ufshcd_core_exit);
  MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>");
  MODULE_AUTHOR("Vinayak Holikatti <h.vinayak@samsung.com>");
  MODULE_DESCRIPTION("Generic UFS host controller driver Core");
 +MODULE_SOFTDEP("pre: governor_simpleondemand");
  MODULE_LICENSE("GPL");
  MODULE_VERSION(UFSHCD_DRIVER_VERSION);
--- 
-2.39.2
-
diff --git a/queue-5.15/scsi-ufs-core-initialize-devfreq-synchronously.patch b/queue-5.15/scsi-ufs-core-initialize-devfreq-synchronously.patch
deleted file mode 100644 (file)
index a55daef..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-From 937e1b69386ea5c3faa8006bdaf94d023014f45e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 Feb 2023 14:44:22 -0500
-Subject: scsi: ufs: core: Initialize devfreq synchronously
-
-From: Adrien Thierry <athierry@redhat.com>
-
-[ Upstream commit 7dafc3e007918384c8693ff8d70381b5c1e9c247 ]
-
-During UFS initialization, devfreq initialization is asynchronous:
-ufshcd_async_scan() calls ufshcd_add_lus(), which in turn initializes
-devfreq for UFS. The simple ondemand governor is then loaded. If it is
-built as a module, request_module() is called and throws a warning:
-
-  WARNING: CPU: 7 PID: 167 at kernel/kmod.c:136 __request_module+0x1e0/0x460
-  Modules linked in: crct10dif_ce llcc_qcom phy_qcom_qmp_usb ufs_qcom phy_qcom_snps_femto_v2 ufshcd_pltfrm phy_qcom_qmp_combo ufshcd_core phy_qcom_qmp_ufs qcom_wdt socinfo fuse ipv6
-  CPU: 7 PID: 167 Comm: kworker/u16:3 Not tainted 6.2.0-rc6-00009-g58706f7fb045 #1
-  Hardware name: Qualcomm SA8540P Ride (DT)
-  Workqueue: events_unbound async_run_entry_fn
-  pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-  pc : __request_module+0x1e0/0x460
-  lr : __request_module+0x1d8/0x460
-  sp : ffff800009323b90
-  x29: ffff800009323b90 x28: 0000000000000000 x27: 0000000000000000
-  x26: ffff800009323d50 x25: ffff7b9045f57810 x24: ffff7b9045f57830
-  x23: ffffdc5a83e426e8 x22: ffffdc5ae80a9818 x21: 0000000000000001
-  x20: ffffdc5ae7502f98 x19: ffff7b9045f57800 x18: ffffffffffffffff
-  x17: 312f716572667665 x16: 642f7366752e3030 x15: 0000000000000000
-  x14: 000000000000021c x13: 0000000000005400 x12: ffff7b9042ed7614
-  x11: ffff7b9042ed7600 x10: 00000000636c0890 x9 : 0000000000000038
-  x8 : ffff7b9045f2c880 x7 : ffff7b9045f57c68 x6 : 0000000000000080
-  x5 : 0000000000000000 x4 : 8000000000000000 x3 : 0000000000000000
-  x2 : 0000000000000000 x1 : ffffdc5ae5d382f0 x0 : 0000000000000001
-  Call trace:
-   __request_module+0x1e0/0x460
-   try_then_request_governor+0x7c/0x100
-   devfreq_add_device+0x4b0/0x5fc
-   ufshcd_async_scan+0x1d4/0x310 [ufshcd_core]
-   async_run_entry_fn+0x34/0xe0
-   process_one_work+0x1d0/0x320
-   worker_thread+0x14c/0x444
-   kthread+0x10c/0x110
-   ret_from_fork+0x10/0x20
-
-This occurs because synchronous module loading from async is not
-allowed. According to __request_module():
-
-  /*
-   * We don't allow synchronous module loading from async.  Module
-   * init may invoke async_synchronize_full() which will end up
-   * waiting for this task which already is waiting for the module
-   * loading to complete, leading to a deadlock.
-   */
-
-Such a deadlock was experienced on the Qualcomm QDrive3/sa8540p-ride. With
-DEVFREQ_GOV_SIMPLE_ONDEMAND=m, the boot hangs after the warning.
-
-Fix both the warning and the deadlock by moving devfreq initialization out
-of the async routine.
-
-Tested on the sa8540p-ride by using fio to put the UFS under load, and
-printing the trace generated by
-/sys/kernel/tracing/events/ufs/ufshcd_clk_scaling events. The trace looks
-similar with and without the change.
-
-Link: https://lore.kernel.org/r/20230217194423.42553-1-athierry@redhat.com
-Signed-off-by: Adrien Thierry <athierry@redhat.com>
-Reviewed-by: Bart Van Assche <bvanassche@acm.org>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/ufs/ufshcd.c | 47 ++++++++++++++++++++++++++-------------
- drivers/scsi/ufs/ufshcd.h |  1 +
- 2 files changed, 32 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
-index 120831428ec6f..eaa91aec036b1 100644
---- a/drivers/scsi/ufs/ufshcd.c
-+++ b/drivers/scsi/ufs/ufshcd.c
-@@ -1307,6 +1307,13 @@ static int ufshcd_devfreq_target(struct device *dev,
-       struct ufs_clk_info *clki;
-       unsigned long irq_flags;
-+      /*
-+       * Skip devfreq if UFS initialization is not finished.
-+       * Otherwise ufs could be in a inconsistent state.
-+       */
-+      if (!smp_load_acquire(&hba->logical_unit_scan_finished))
-+              return 0;
-+
-       if (!ufshcd_is_clkscaling_supported(hba))
-               return -EINVAL;
-@@ -7881,22 +7888,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
-       if (ret)
-               goto out;
--      /* Initialize devfreq after UFS device is detected */
--      if (ufshcd_is_clkscaling_supported(hba)) {
--              memcpy(&hba->clk_scaling.saved_pwr_info.info,
--                      &hba->pwr_info,
--                      sizeof(struct ufs_pa_layer_attr));
--              hba->clk_scaling.saved_pwr_info.is_valid = true;
--              hba->clk_scaling.is_allowed = true;
--
--              ret = ufshcd_devfreq_init(hba);
--              if (ret)
--                      goto out;
--
--              hba->clk_scaling.is_enabled = true;
--              ufshcd_init_clk_scaling_sysfs(hba);
--      }
--
-       ufs_bsg_probe(hba);
-       ufshpb_init(hba);
-       scsi_scan_host(hba->host);
-@@ -8030,6 +8021,12 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
-       if (ret) {
-               pm_runtime_put_sync(hba->dev);
-               ufshcd_hba_exit(hba);
-+      } else {
-+              /*
-+               * Make sure that when reader code sees UFS initialization has finished,
-+               * all initialization steps have really been executed.
-+               */
-+              smp_store_release(&hba->logical_unit_scan_finished, true);
-       }
- }
-@@ -9590,12 +9587,30 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
-        */
-       ufshcd_set_ufs_dev_active(hba);
-+      /* Initialize devfreq */
-+      if (ufshcd_is_clkscaling_supported(hba)) {
-+              memcpy(&hba->clk_scaling.saved_pwr_info.info,
-+                      &hba->pwr_info,
-+                      sizeof(struct ufs_pa_layer_attr));
-+              hba->clk_scaling.saved_pwr_info.is_valid = true;
-+              hba->clk_scaling.is_allowed = true;
-+
-+              err = ufshcd_devfreq_init(hba);
-+              if (err)
-+                      goto rpm_put_sync;
-+
-+              hba->clk_scaling.is_enabled = true;
-+              ufshcd_init_clk_scaling_sysfs(hba);
-+      }
-+
-       async_schedule(ufshcd_async_scan, hba);
-       ufs_sysfs_add_nodes(hba->dev);
-       device_enable_async_suspend(dev);
-       return 0;
-+rpm_put_sync:
-+      pm_runtime_put_sync(dev);
- free_tmf_queue:
-       blk_cleanup_queue(hba->tmf_queue);
- free_tmf_tag_set:
-diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
-index c8513cc6c2bdd..33d9c096ec7fd 100644
---- a/drivers/scsi/ufs/ufshcd.h
-+++ b/drivers/scsi/ufs/ufshcd.h
-@@ -838,6 +838,7 @@ struct ufs_hba {
-       struct completion *uic_async_done;
-       enum ufshcd_state ufshcd_state;
-+      bool logical_unit_scan_finished;
-       u32 eh_flags;
-       u32 intr_mask;
-       u16 ee_ctrl_mask; /* Exception event mask */
--- 
-2.39.2
-
index 537a76945fc0a8ce672add2a2caa0a80e1219f34..1ff55556eeb4f70e3ab59c1f1d1f2b02d9793165 100644 (file)
@@ -79,7 +79,6 @@ thunderbolt-disable-interrupt-auto-clear-for-rings.patch
 thunderbolt-add-missing-unset_inbound_sbtx-for-retimer-access.patch
 thunderbolt-use-const-qualifier-for-ring_interrupt_index.patch
 thunderbolt-rename-shadowed-variables-bit-to-interrupt_bit-and-auto_clear_bit.patch
-scsi-ufs-core-initialize-devfreq-synchronously.patch
 acpi-x86-utils-add-cezanne-to-the-list-for-forcing-s.patch
 riscv-bump-command_line_size-value-to-1024.patch
 drm-cirrus-null-check-pipe-plane.state-fb-in-cirrus_.patch
index 6e0d9adad52a69d0b70eb9f23495a0a634ac60b6..51ff23c9887ec599eca393b1e3277a9852f05be2 100644 (file)
@@ -25,7 +25,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 
 --- a/fs/btrfs/zoned.c
 +++ b/fs/btrfs/zoned.c
-@@ -2113,11 +2113,21 @@ bool btrfs_can_activate_zone(struct btrf
+@@ -2099,11 +2099,21 @@ bool btrfs_can_activate_zone(struct btrf
                if (!device->bdev)
                        continue;
  
index f335f6e6db1cdbf28e32b74b5c289720f89dde83..4e4cef904d415816812dac064b63ed31cdcf64df 100644 (file)
@@ -17,19 +17,14 @@ Signed-off-by: Adrien Thierry <athierry@redhat.com>
 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/ufs/core/ufshcd.c | 1 +
+ drivers/ufs/core/ufshcd.c |    1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
-index e652624c449a9..82ecf776f9054 100644
 --- a/drivers/ufs/core/ufshcd.c
 +++ b/drivers/ufs/core/ufshcd.c
-@@ -10089,4 +10089,5 @@ module_exit(ufshcd_core_exit);
+@@ -10074,4 +10074,5 @@ module_exit(ufshcd_core_exit);
  MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>");
  MODULE_AUTHOR("Vinayak Holikatti <h.vinayak@samsung.com>");
  MODULE_DESCRIPTION("Generic UFS host controller driver Core");
 +MODULE_SOFTDEP("pre: governor_simpleondemand");
  MODULE_LICENSE("GPL");
--- 
-2.39.2
-
diff --git a/queue-6.1/scsi-ufs-core-initialize-devfreq-synchronously.patch b/queue-6.1/scsi-ufs-core-initialize-devfreq-synchronously.patch
deleted file mode 100644 (file)
index 44f34fc..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-From 3703580d87d909b29327f0c613010154410bf79b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 Feb 2023 14:44:22 -0500
-Subject: scsi: ufs: core: Initialize devfreq synchronously
-
-From: Adrien Thierry <athierry@redhat.com>
-
-[ Upstream commit 7dafc3e007918384c8693ff8d70381b5c1e9c247 ]
-
-During UFS initialization, devfreq initialization is asynchronous:
-ufshcd_async_scan() calls ufshcd_add_lus(), which in turn initializes
-devfreq for UFS. The simple ondemand governor is then loaded. If it is
-built as a module, request_module() is called and throws a warning:
-
-  WARNING: CPU: 7 PID: 167 at kernel/kmod.c:136 __request_module+0x1e0/0x460
-  Modules linked in: crct10dif_ce llcc_qcom phy_qcom_qmp_usb ufs_qcom phy_qcom_snps_femto_v2 ufshcd_pltfrm phy_qcom_qmp_combo ufshcd_core phy_qcom_qmp_ufs qcom_wdt socinfo fuse ipv6
-  CPU: 7 PID: 167 Comm: kworker/u16:3 Not tainted 6.2.0-rc6-00009-g58706f7fb045 #1
-  Hardware name: Qualcomm SA8540P Ride (DT)
-  Workqueue: events_unbound async_run_entry_fn
-  pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-  pc : __request_module+0x1e0/0x460
-  lr : __request_module+0x1d8/0x460
-  sp : ffff800009323b90
-  x29: ffff800009323b90 x28: 0000000000000000 x27: 0000000000000000
-  x26: ffff800009323d50 x25: ffff7b9045f57810 x24: ffff7b9045f57830
-  x23: ffffdc5a83e426e8 x22: ffffdc5ae80a9818 x21: 0000000000000001
-  x20: ffffdc5ae7502f98 x19: ffff7b9045f57800 x18: ffffffffffffffff
-  x17: 312f716572667665 x16: 642f7366752e3030 x15: 0000000000000000
-  x14: 000000000000021c x13: 0000000000005400 x12: ffff7b9042ed7614
-  x11: ffff7b9042ed7600 x10: 00000000636c0890 x9 : 0000000000000038
-  x8 : ffff7b9045f2c880 x7 : ffff7b9045f57c68 x6 : 0000000000000080
-  x5 : 0000000000000000 x4 : 8000000000000000 x3 : 0000000000000000
-  x2 : 0000000000000000 x1 : ffffdc5ae5d382f0 x0 : 0000000000000001
-  Call trace:
-   __request_module+0x1e0/0x460
-   try_then_request_governor+0x7c/0x100
-   devfreq_add_device+0x4b0/0x5fc
-   ufshcd_async_scan+0x1d4/0x310 [ufshcd_core]
-   async_run_entry_fn+0x34/0xe0
-   process_one_work+0x1d0/0x320
-   worker_thread+0x14c/0x444
-   kthread+0x10c/0x110
-   ret_from_fork+0x10/0x20
-
-This occurs because synchronous module loading from async is not
-allowed. According to __request_module():
-
-  /*
-   * We don't allow synchronous module loading from async.  Module
-   * init may invoke async_synchronize_full() which will end up
-   * waiting for this task which already is waiting for the module
-   * loading to complete, leading to a deadlock.
-   */
-
-Such a deadlock was experienced on the Qualcomm QDrive3/sa8540p-ride. With
-DEVFREQ_GOV_SIMPLE_ONDEMAND=m, the boot hangs after the warning.
-
-Fix both the warning and the deadlock by moving devfreq initialization out
-of the async routine.
-
-Tested on the sa8540p-ride by using fio to put the UFS under load, and
-printing the trace generated by
-/sys/kernel/tracing/events/ufs/ufshcd_clk_scaling events. The trace looks
-similar with and without the change.
-
-Link: https://lore.kernel.org/r/20230217194423.42553-1-athierry@redhat.com
-Signed-off-by: Adrien Thierry <athierry@redhat.com>
-Reviewed-by: Bart Van Assche <bvanassche@acm.org>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ufs/core/ufshcd.c | 47 ++++++++++++++++++++++++++-------------
- include/ufs/ufshcd.h      |  1 +
- 2 files changed, 32 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
-index edd34dac91b1d..e652624c449a9 100644
---- a/drivers/ufs/core/ufshcd.c
-+++ b/drivers/ufs/core/ufshcd.c
-@@ -1354,6 +1354,13 @@ static int ufshcd_devfreq_target(struct device *dev,
-       struct ufs_clk_info *clki;
-       unsigned long irq_flags;
-+      /*
-+       * Skip devfreq if UFS initialization is not finished.
-+       * Otherwise ufs could be in a inconsistent state.
-+       */
-+      if (!smp_load_acquire(&hba->logical_unit_scan_finished))
-+              return 0;
-+
-       if (!ufshcd_is_clkscaling_supported(hba))
-               return -EINVAL;
-@@ -8184,22 +8191,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
-       if (ret)
-               goto out;
--      /* Initialize devfreq after UFS device is detected */
--      if (ufshcd_is_clkscaling_supported(hba)) {
--              memcpy(&hba->clk_scaling.saved_pwr_info.info,
--                      &hba->pwr_info,
--                      sizeof(struct ufs_pa_layer_attr));
--              hba->clk_scaling.saved_pwr_info.is_valid = true;
--              hba->clk_scaling.is_allowed = true;
--
--              ret = ufshcd_devfreq_init(hba);
--              if (ret)
--                      goto out;
--
--              hba->clk_scaling.is_enabled = true;
--              ufshcd_init_clk_scaling_sysfs(hba);
--      }
--
-       ufs_bsg_probe(hba);
-       ufshpb_init(hba);
-       scsi_scan_host(hba->host);
-@@ -8338,6 +8329,12 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
-       if (ret) {
-               pm_runtime_put_sync(hba->dev);
-               ufshcd_hba_exit(hba);
-+      } else {
-+              /*
-+               * Make sure that when reader code sees UFS initialization has finished,
-+               * all initialization steps have really been executed.
-+               */
-+              smp_store_release(&hba->logical_unit_scan_finished, true);
-       }
- }
-@@ -9892,12 +9889,30 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
-        */
-       ufshcd_set_ufs_dev_active(hba);
-+      /* Initialize devfreq */
-+      if (ufshcd_is_clkscaling_supported(hba)) {
-+              memcpy(&hba->clk_scaling.saved_pwr_info.info,
-+                      &hba->pwr_info,
-+                      sizeof(struct ufs_pa_layer_attr));
-+              hba->clk_scaling.saved_pwr_info.is_valid = true;
-+              hba->clk_scaling.is_allowed = true;
-+
-+              err = ufshcd_devfreq_init(hba);
-+              if (err)
-+                      goto rpm_put_sync;
-+
-+              hba->clk_scaling.is_enabled = true;
-+              ufshcd_init_clk_scaling_sysfs(hba);
-+      }
-+
-       async_schedule(ufshcd_async_scan, hba);
-       ufs_sysfs_add_nodes(hba->dev);
-       device_enable_async_suspend(dev);
-       return 0;
-+rpm_put_sync:
-+      pm_runtime_put_sync(dev);
- free_tmf_queue:
-       blk_mq_destroy_queue(hba->tmf_queue);
- free_tmf_tag_set:
-diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
-index b54f22840dabf..0ef1ec6a3b4d1 100644
---- a/include/ufs/ufshcd.h
-+++ b/include/ufs/ufshcd.h
-@@ -894,6 +894,7 @@ struct ufs_hba {
-       struct completion *uic_async_done;
-       enum ufshcd_state ufshcd_state;
-+      bool logical_unit_scan_finished;
-       u32 eh_flags;
-       u32 intr_mask;
-       u16 ee_ctrl_mask;
--- 
-2.39.2
-
index 3bb861c2bb20bbd44ceb8ab92cd75f3c9cf7c073..268ef92027a93e44edade1daf4d82ac8ee452c37 100644 (file)
@@ -114,7 +114,6 @@ thunderbolt-add-missing-unset_inbound_sbtx-for-retimer-access.patch
 thunderbolt-use-const-qualifier-for-ring_interrupt_index.patch
 thunderbolt-rename-shadowed-variables-bit-to-interrupt_bit-and-auto_clear_bit.patch
 asoc-amd-yp-add-omen-by-hp-gaming-laptop-16z-n000-to.patch
-scsi-ufs-core-initialize-devfreq-synchronously.patch
 asoc-amd-yc-add-dmi-entries-to-support-hp-omen-16-n0.patch
 acpi-x86-drop-quirk-for-hp-elitebook.patch
 acpi-x86-utils-add-cezanne-to-the-list-for-forcing-s.patch
index 14f1d5cad841516a22f8c945bdc9eca91d7689d4..28fecc25a1874bb7c0cf2df2721263553f9cebe4 100644 (file)
@@ -17,19 +17,14 @@ Signed-off-by: Adrien Thierry <athierry@redhat.com>
 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- drivers/ufs/core/ufshcd.c | 1 +
+ drivers/ufs/core/ufshcd.c |    1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
-index d7fa053a78965..0fe72ddbff64a 100644
 --- a/drivers/ufs/core/ufshcd.c
 +++ b/drivers/ufs/core/ufshcd.c
-@@ -10110,4 +10110,5 @@ module_exit(ufshcd_core_exit);
+@@ -10095,4 +10095,5 @@ module_exit(ufshcd_core_exit);
  MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>");
  MODULE_AUTHOR("Vinayak Holikatti <h.vinayak@samsung.com>");
  MODULE_DESCRIPTION("Generic UFS host controller driver Core");
 +MODULE_SOFTDEP("pre: governor_simpleondemand");
  MODULE_LICENSE("GPL");
--- 
-2.39.2
-
diff --git a/queue-6.2/scsi-ufs-core-initialize-devfreq-synchronously.patch b/queue-6.2/scsi-ufs-core-initialize-devfreq-synchronously.patch
deleted file mode 100644 (file)
index 559af73..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-From a4df992a59dca8ae786bec622137f5880261abdd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 Feb 2023 14:44:22 -0500
-Subject: scsi: ufs: core: Initialize devfreq synchronously
-
-From: Adrien Thierry <athierry@redhat.com>
-
-[ Upstream commit 7dafc3e007918384c8693ff8d70381b5c1e9c247 ]
-
-During UFS initialization, devfreq initialization is asynchronous:
-ufshcd_async_scan() calls ufshcd_add_lus(), which in turn initializes
-devfreq for UFS. The simple ondemand governor is then loaded. If it is
-built as a module, request_module() is called and throws a warning:
-
-  WARNING: CPU: 7 PID: 167 at kernel/kmod.c:136 __request_module+0x1e0/0x460
-  Modules linked in: crct10dif_ce llcc_qcom phy_qcom_qmp_usb ufs_qcom phy_qcom_snps_femto_v2 ufshcd_pltfrm phy_qcom_qmp_combo ufshcd_core phy_qcom_qmp_ufs qcom_wdt socinfo fuse ipv6
-  CPU: 7 PID: 167 Comm: kworker/u16:3 Not tainted 6.2.0-rc6-00009-g58706f7fb045 #1
-  Hardware name: Qualcomm SA8540P Ride (DT)
-  Workqueue: events_unbound async_run_entry_fn
-  pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-  pc : __request_module+0x1e0/0x460
-  lr : __request_module+0x1d8/0x460
-  sp : ffff800009323b90
-  x29: ffff800009323b90 x28: 0000000000000000 x27: 0000000000000000
-  x26: ffff800009323d50 x25: ffff7b9045f57810 x24: ffff7b9045f57830
-  x23: ffffdc5a83e426e8 x22: ffffdc5ae80a9818 x21: 0000000000000001
-  x20: ffffdc5ae7502f98 x19: ffff7b9045f57800 x18: ffffffffffffffff
-  x17: 312f716572667665 x16: 642f7366752e3030 x15: 0000000000000000
-  x14: 000000000000021c x13: 0000000000005400 x12: ffff7b9042ed7614
-  x11: ffff7b9042ed7600 x10: 00000000636c0890 x9 : 0000000000000038
-  x8 : ffff7b9045f2c880 x7 : ffff7b9045f57c68 x6 : 0000000000000080
-  x5 : 0000000000000000 x4 : 8000000000000000 x3 : 0000000000000000
-  x2 : 0000000000000000 x1 : ffffdc5ae5d382f0 x0 : 0000000000000001
-  Call trace:
-   __request_module+0x1e0/0x460
-   try_then_request_governor+0x7c/0x100
-   devfreq_add_device+0x4b0/0x5fc
-   ufshcd_async_scan+0x1d4/0x310 [ufshcd_core]
-   async_run_entry_fn+0x34/0xe0
-   process_one_work+0x1d0/0x320
-   worker_thread+0x14c/0x444
-   kthread+0x10c/0x110
-   ret_from_fork+0x10/0x20
-
-This occurs because synchronous module loading from async is not
-allowed. According to __request_module():
-
-  /*
-   * We don't allow synchronous module loading from async.  Module
-   * init may invoke async_synchronize_full() which will end up
-   * waiting for this task which already is waiting for the module
-   * loading to complete, leading to a deadlock.
-   */
-
-Such a deadlock was experienced on the Qualcomm QDrive3/sa8540p-ride. With
-DEVFREQ_GOV_SIMPLE_ONDEMAND=m, the boot hangs after the warning.
-
-Fix both the warning and the deadlock by moving devfreq initialization out
-of the async routine.
-
-Tested on the sa8540p-ride by using fio to put the UFS under load, and
-printing the trace generated by
-/sys/kernel/tracing/events/ufs/ufshcd_clk_scaling events. The trace looks
-similar with and without the change.
-
-Link: https://lore.kernel.org/r/20230217194423.42553-1-athierry@redhat.com
-Signed-off-by: Adrien Thierry <athierry@redhat.com>
-Reviewed-by: Bart Van Assche <bvanassche@acm.org>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/ufs/core/ufshcd.c | 47 ++++++++++++++++++++++++++-------------
- include/ufs/ufshcd.h      |  1 +
- 2 files changed, 32 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
-index 2ddc1aba0ad75..d7fa053a78965 100644
---- a/drivers/ufs/core/ufshcd.c
-+++ b/drivers/ufs/core/ufshcd.c
-@@ -1357,6 +1357,13 @@ static int ufshcd_devfreq_target(struct device *dev,
-       struct ufs_clk_info *clki;
-       unsigned long irq_flags;
-+      /*
-+       * Skip devfreq if UFS initialization is not finished.
-+       * Otherwise ufs could be in a inconsistent state.
-+       */
-+      if (!smp_load_acquire(&hba->logical_unit_scan_finished))
-+              return 0;
-+
-       if (!ufshcd_is_clkscaling_supported(hba))
-               return -EINVAL;
-@@ -8152,22 +8159,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
-       if (ret)
-               goto out;
--      /* Initialize devfreq after UFS device is detected */
--      if (ufshcd_is_clkscaling_supported(hba)) {
--              memcpy(&hba->clk_scaling.saved_pwr_info.info,
--                      &hba->pwr_info,
--                      sizeof(struct ufs_pa_layer_attr));
--              hba->clk_scaling.saved_pwr_info.is_valid = true;
--              hba->clk_scaling.is_allowed = true;
--
--              ret = ufshcd_devfreq_init(hba);
--              if (ret)
--                      goto out;
--
--              hba->clk_scaling.is_enabled = true;
--              ufshcd_init_clk_scaling_sysfs(hba);
--      }
--
-       ufs_bsg_probe(hba);
-       ufshpb_init(hba);
-       scsi_scan_host(hba->host);
-@@ -8306,6 +8297,12 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
-       if (ret) {
-               pm_runtime_put_sync(hba->dev);
-               ufshcd_hba_exit(hba);
-+      } else {
-+              /*
-+               * Make sure that when reader code sees UFS initialization has finished,
-+               * all initialization steps have really been executed.
-+               */
-+              smp_store_release(&hba->logical_unit_scan_finished, true);
-       }
- }
-@@ -9912,12 +9909,30 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
-        */
-       ufshcd_set_ufs_dev_active(hba);
-+      /* Initialize devfreq */
-+      if (ufshcd_is_clkscaling_supported(hba)) {
-+              memcpy(&hba->clk_scaling.saved_pwr_info.info,
-+                      &hba->pwr_info,
-+                      sizeof(struct ufs_pa_layer_attr));
-+              hba->clk_scaling.saved_pwr_info.is_valid = true;
-+              hba->clk_scaling.is_allowed = true;
-+
-+              err = ufshcd_devfreq_init(hba);
-+              if (err)
-+                      goto rpm_put_sync;
-+
-+              hba->clk_scaling.is_enabled = true;
-+              ufshcd_init_clk_scaling_sysfs(hba);
-+      }
-+
-       async_schedule(ufshcd_async_scan, hba);
-       ufs_sysfs_add_nodes(hba->dev);
-       device_enable_async_suspend(dev);
-       return 0;
-+rpm_put_sync:
-+      pm_runtime_put_sync(dev);
- free_tmf_queue:
-       blk_mq_destroy_queue(hba->tmf_queue);
-       blk_put_queue(hba->tmf_queue);
-diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
-index 97a09a14c6349..4b6d63ca8c5d8 100644
---- a/include/ufs/ufshcd.h
-+++ b/include/ufs/ufshcd.h
-@@ -896,6 +896,7 @@ struct ufs_hba {
-       struct completion *uic_async_done;
-       enum ufshcd_state ufshcd_state;
-+      bool logical_unit_scan_finished;
-       u32 eh_flags;
-       u32 intr_mask;
-       u16 ee_ctrl_mask;
--- 
-2.39.2
-
index d3c73022c3ee27fffad19dcf29527bff5323c19c..7095a8403d887d56835144eb4e66ae21cdefb66b 100644 (file)
@@ -125,7 +125,6 @@ thunderbolt-use-const-qualifier-for-ring_interrupt_index.patch
 thunderbolt-rename-shadowed-variables-bit-to-interrupt_bit-and-auto_clear_bit.patch
 asoc-amd-yp-add-omen-by-hp-gaming-laptop-16z-n000-to.patch
 asoc-intel-sof_rt5682-add-quirk-for-rex-board-with-m.patch
-scsi-ufs-core-initialize-devfreq-synchronously.patch
 asoc-amd-yc-add-dmi-entries-to-support-hp-omen-16-n0.patch
 acpi-x86-drop-quirk-for-hp-elitebook.patch
 acpi-x86-utils-add-cezanne-to-the-list-for-forcing-s.patch