Skip to contentSkip to conversation

mmc: sdhci: Do not allow tuning procedure to be interrupted

PATCH Superseded [email protected] 3 participants 5 messages Aug 16, 2016 – Aug 18, 2016

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mmc: sdhci: Do not allow tuning procedure to be interrupted

From: Christopher Freeman <[email protected]>

wait_event_interruptible_timeout() will return early if the blocked process receives a signal, causing the driver to abort the tuning procedure and possibly leaving the controller in a bad state. Since the tuning command is expected to complete quickly (<50ms) and we've set a timeout, use wait_event_timeout() instead.

---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
index 0e3d7c0..9e80203 100644
@@ -1960,7 +1960,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
 		spin_unlock_irqrestore(&host->lock, flags);
 		/* Wait for Buffer Read Ready interrupt */
-		wait_event_interruptible_timeout(host->buf_ready_int,
+		wait_event_timeout(host->buf_ready_int,
 					(host->tuning_done == 1),
 					msecs_to_jiffies(50));
 		spin_lock_irqsave(&host->lock, flags);
Signature · 1 line
2.7.4
maintainer Acked-by on v3 1/1
#1 lore raw
Quoted 8 lines · On 17/08/16 00:25, [email protected] wrote:

From: Christopher Freeman <[email protected]>

wait_event_interruptible_timeout() will return early if the blocked process receives a signal, causing the driver to abort the tuning procedure and possibly leaving the controller in a bad state. Since the tuning command is expected to complete quickly (<50ms) and we've set a timeout, use wait_event_timeout() instead.

Quoted 4 lines

The mmc block queues are kernel threads which I would expect ignore signals, so I am curious how you hit this?

In any case:

Quoted 18 lines
---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
index 0e3d7c0..9e80203 100644
@@ -1960,7 +1960,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
 
 		spin_unlock_irqrestore(&host->lock, flags);
 		/* Wait for Buffer Read Ready interrupt */
-		wait_event_interruptible_timeout(host->buf_ready_int,
+		wait_event_timeout(host->buf_ready_int,
 					(host->tuning_done == 1),
 					msecs_to_jiffies(50));
 		spin_lock_irqsave(&host->lock, flags);
#2 lore raw
Quoted 9 lines · Adrian Hunter
Quoted 8 lines · On 17/08/16 00:25, [email protected] wrote:

From: Christopher Freeman <[email protected]>

wait_event_interruptible_timeout() will return early if the blocked process receives a signal, causing the driver to abort the tuning procedure and possibly leaving the controller in a bad state. Since the tuning command is expected to complete quickly (<50ms) and we've set a timeout, use wait_event_timeout() instead.

Quoted 7 lines
Quoted 4 lines

The mmc block queues are kernel threads which I would expect ignore signals, so I am curious how you hit this?

The issue was discovered on (tegra2?) hardware that is sensitive to being interrupted during tuning and having the controller left in a sensitive state.

@Christopher Freeman: Maybe you can provide us with some additional details?

Quoted 5 lines

In any case:

#3 lore raw
Quoted 17 lines · Robert Foss
Quoted 14 lines · Adrian Hunter
Quoted 12 lines · On 17/08/16 00:25, [email protected] wrote:

From: Christopher Freeman <[email protected]>

wait_event_interruptible_timeout() will return early if the blocked process receives a signal, causing the driver to abort the tuning procedure and possibly leaving the controller in a bad state. Since the tuning command is expected to complete quickly (<50ms) and we've set a timeout, use wait_event_timeout() instead.

Quoted 9 lines
Quoted 2 lines

The mmc block queues are kernel threads which I would expect ignore signals, so I am curious how you hit this?

The issue was discovered on (tegra2?) hardware that is sensitive to being interrupted during tuning and having the controller left in a sensitive state.

@Christopher Freeman: Maybe you can provide us with some additional details?

It was found with Tegra 210. The signalling was an issue because tuning was kicked off from an ioctl to the wifi device on the controller.

FWIW, this issue was particular to the wifi driver (bcmdhd) and the android
tree. It in part depends on the way the wifi driver is able to reset the
sdio device via a routine that's not present in mainline: sdio_reset_comm. I believe the wifi driver would power on the wifi chip and trigger tuning in the aforementioned ioctl. Process that sent the ioctl was some network or wifi manager service on Android.

Let me know if you would like any more details.

Quoted 5 lines
Quoted 5 lines

In any case:

maintainer
#4 lore raw
Quoted 31 lines · Christopher Freeman
Quoted 17 lines · Robert Foss
Quoted 14 lines · Adrian Hunter
Quoted 12 lines · On 17/08/16 00:25, [email protected] wrote:

From: Christopher Freeman <[email protected]>

wait_event_interruptible_timeout() will return early if the blocked process receives a signal, causing the driver to abort the tuning procedure and possibly leaving the controller in a bad state. Since the tuning command is expected to complete quickly (<50ms) and we've set a timeout, use wait_event_timeout() instead.

Quoted 9 lines
Quoted 2 lines

The mmc block queues are kernel threads which I would expect ignore signals, so I am curious how you hit this?

The issue was discovered on (tegra2?) hardware that is sensitive to being interrupted during tuning and having the controller left in a sensitive state.

@Christopher Freeman: Maybe you can provide us with some additional details?

It was found with Tegra 210. The signalling was an issue because tuning was kicked off from an ioctl to the wifi device on the controller.

Quoted 8 lines

FWIW, this issue was particular to the wifi driver (bcmdhd) and the android
tree. It in part depends on the way the wifi driver is able to reset the
sdio device via a routine that's not present in mainline: sdio_reset_comm. I believe the wifi driver would power on the wifi chip and trigger tuning in the aforementioned ioctl. Process that sent the ioctl was some network or wifi manager service on Android.

Let me know if you would like any more details.

Thanks for the explanation.

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

In any case: