Skip to contentSkip to conversation

mmc: sdio: change to use system_freezable_wq for sdio_irq_work

PATCH In review [email protected] 2 participants 3 messages Aug 6, 2020 – Aug 21, 2020 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdio: change to use system_freezable_wq for sdio_irq_work

From: Haibo Chen <[email protected]>

Change to use system_freezable_wq because it can make sure the queue becomes frozen when userspace becomes frozen during system PM.

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

---
 drivers/mmc/core/sdio.c     | 2 +-
 drivers/mmc/core/sdio_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/sdio.c +1 -1
index 26cabd53ddc5..269ae63d09eb 100644
@@ -1015,7 +1015,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
 		if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
 			wake_up_process(host->sdio_irq_thread);
 		else if (host->caps & MMC_CAP_SDIO_IRQ)
-			queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+			queue_delayed_work(system_freezable_wq, &host->sdio_irq_work, 0);
 	}
 
 out:
drivers/mmc/core/sdio_irq.c +1 -1
index 900871073bd7..9d7ec48bd963 100644
@@ -132,7 +132,7 @@ void sdio_irq_work(struct work_struct *work)
 void sdio_signal_irq(struct mmc_host *host)
 {
 	host->sdio_irq_pending = true;
-	queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+	queue_delayed_work(system_freezable_wq, &host->sdio_irq_work, 0);
 }
 EXPORT_SYMBOL_GPL(sdio_signal_irq);
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · On Thu, 6 Aug 2020 at 10:23, <[email protected]> wrote:

From: Haibo Chen <[email protected]>

Change to use system_freezable_wq because it can make sure the queue becomes frozen when userspace becomes frozen during system PM.

Quoted 8 lines

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

Moving to the system_freezable_wq doesn't work. Simply because it's too early in the system suspend phase to freeze the queue for SDIO irqs.

I guess you figured that out, so you posted a v2? Moving to review that now..

Kind regards
Uffe

Quoted 36 lines
---
 drivers/mmc/core/sdio.c     | 2 +-
 drivers/mmc/core/sdio_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/sdio.c +1 -1
index 26cabd53ddc5..269ae63d09eb 100644
@@ -1015,7 +1015,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
                if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
                        wake_up_process(host->sdio_irq_thread);
                else if (host->caps & MMC_CAP_SDIO_IRQ)
-                       queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+                       queue_delayed_work(system_freezable_wq, &host->sdio_irq_work, 0);
        }
 
 out:
drivers/mmc/core/sdio_irq.c +1 -2
index 900871073bd7..9d7ec48bd963 100644
@@ -132,7 +132,7 @@ void sdio_irq_work(struct work_struct *work)
 void sdio_signal_irq(struct mmc_host *host)
 {
        host->sdio_irq_pending = true;
-       queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+       queue_delayed_work(system_freezable_wq, &host->sdio_irq_work, 0);
 }
 EXPORT_SYMBOL_GPL(sdio_signal_irq);
 
--

2.17.1

author
#2 lore raw
Quoted 26 lines

-----Original Message-----
From: Ulf Hansson [mailto:[email protected]]
Sent: 2020年8月21日 15:50
To: Bough Chen <[email protected]>
Cc: Adrian Hunter <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; Matthias Kaehlcke <[email protected]>; Doug Anderson <[email protected]>
Subject: Re: [PATCH] mmc: sdio: change to use system_freezable_wq for sdio_irq_work

Quoted 6 lines · On Thu, 6 Aug 2020 at 10:23, <[email protected]> wrote:

From: Haibo Chen <[email protected]>

Change to use system_freezable_wq because it can make sure the queue becomes frozen when userspace becomes frozen during system PM.

Quoted 7 lines

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

Quoted 4 lines

Moving to the system_freezable_wq doesn't work. Simply because it's too early in the system suspend phase to freeze the queue for SDIO irqs.

I guess you figured that out, so you posted a v2? Moving to review that now..

Hi Ulf,

For the V1 patch, it can fix the issue on imx7d board with Broadcom wifi. But this patch will cause issue when switch to use Marvell 8989 sdio wifi.

Best Regards
Haibo Chen

Quoted 44 lines

Kind regards
Uffe

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host

Quoted 12 lines
---
 drivers/mmc/core/sdio.c     | 2 +-
 drivers/mmc/core/sdio_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/sdio.c index renamed from drivers/mmc/core/sdio.c +0 -0

26cabd53ddc5..269ae63d09eb 100644

drivers/mmc/core/sdio.c +0 -0
@@ -1015,7 +1015,7 @@ static int mmc_sdio_resume(struct mmc_host

*host)

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host *host)

Quoted 4 lines
drivers/mmc/core/sdio.c +0 -1
                if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
                        wake_up_process(host->sdio_irq_thread);
                else if (host->caps & MMC_CAP_SDIO_IRQ)
-                       queue_delayed_work(system_wq,

&host->sdio_irq_work, 0);

Quoted 10 lines
drivers/mmc/core/sdio.c +2 -0
+                       queue_delayed_work(system_freezable_wq,
+ &host->sdio_irq_work, 0);
        }
 
 out:
drivers/mmc/core/sdio_irq.c +0 -0
index 900871073bd7..9d7ec48bd963 100644

drivers/mmc/core/sdio_irq.c void sdio_irq_work(struct work_struct *work) void · line 134

Quoted 4 lines
drivers/mmc/core/sdio_irq.c +1 -1
@@ -132,7 +132,7 @@ void sdio_irq_work(struct work_struct *work)  void
 sdio_signal_irq(struct mmc_host *host)  {
        host->sdio_irq_pending = true;
-       queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+       queue_delayed_work(system_freezable_wq,

&host->sdio_irq_work,

Quoted 7 lines
drivers/mmc/core/sdio_irq.c +1 -1
+ 0);
 }
 EXPORT_SYMBOL_GPL(sdio_signal_irq);
 
--

2.17.1