* [PATCH 0/3] mmc: avoid vicious circle when retuning
@ 2021-06-24 15:16 Wolfram Sang
2021-06-24 15:16 ` [PATCH 1/3] mmc: core: clear flags before allowing to retune Wolfram Sang
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Wolfram Sang @ 2021-06-24 15:16 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, Adrian Hunter, Yoshihiro Shimoda, Wolfram Sang
See patch 1 for a description of the problem. This series implements the
alternative approach suggested by Adrian (thanks!). It also adds some
documentation and a minor cleanup which I came up with while working on
the fix. Patch 1 can go to stable as is, the rest built on top of that.
This series fixes the performance issue which we saw when injecting CRC
errors on Renesas R-Car Gen3 hardware.
Looking forward to comments!
Wolfram Sang (3):
mmc: core: clear flags before allowing to retune
mmc: host: add kdoc for mmc_retune_{en|dis}able
mmc: host: factor out clearing the retune state
drivers/mmc/core/core.c | 6 ++++--
drivers/mmc/core/host.c | 13 +++++++++++--
drivers/mmc/core/host.h | 6 ++++++
3 files changed, 21 insertions(+), 4 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] mmc: core: clear flags before allowing to retune
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
@ 2021-06-24 15:16 ` Wolfram Sang
2021-06-24 15:16 ` [PATCH 2/3] mmc: host: add kdoc for mmc_retune_{en|dis}able Wolfram Sang
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2021-06-24 15:16 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, Adrian Hunter, Yoshihiro Shimoda, Wolfram Sang
It might be that something goes wrong during tuning so the MMC core will
immediately trigger a retune. In our case it was:
- we sent a tuning block
- there was an error so we need to send an abort cmd to the eMMC
- the abort cmd had a CRC error
- retune was set by the MMC core
This lead to a vicious circle causing a performance regression of 75%.
So, clear retuning flags before we enable retuning to start with a known
cleared state.
Reported-by Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 4e52eb14198a..f397cf051b8d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -937,11 +937,14 @@ int mmc_execute_tuning(struct mmc_card *card)
err = host->ops->execute_tuning(host, opcode);
- if (err)
+ if (err) {
pr_err("%s: tuning execution failed: %d\n",
mmc_hostname(host), err);
- else
+ } else {
+ host->retune_now = 0;
+ host->need_retune = 0;
mmc_retune_enable(host);
+ }
return err;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] mmc: host: add kdoc for mmc_retune_{en|dis}able
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
2021-06-24 15:16 ` [PATCH 1/3] mmc: core: clear flags before allowing to retune Wolfram Sang
@ 2021-06-24 15:16 ` Wolfram Sang
2021-06-24 15:16 ` [PATCH 3/3] mmc: host: factor out clearing the retune state Wolfram Sang
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2021-06-24 15:16 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, Adrian Hunter, Yoshihiro Shimoda, Wolfram Sang
I wanted to use it in a wrong way, so document the intended way.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/host.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index eda4a1892c33..0f084c9b2684 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -95,6 +95,10 @@ void mmc_unregister_host_class(void)
class_unregister(&mmc_host_class);
}
+/**
+ * mmc_retune_enable() - enter a transfer mode that requires retuning
+ * @host: host which should retune now
+ */
void mmc_retune_enable(struct mmc_host *host)
{
host->can_retune = 1;
@@ -126,6 +130,12 @@ void mmc_retune_unpause(struct mmc_host *host)
}
EXPORT_SYMBOL(mmc_retune_unpause);
+/**
+ * mmc_retune_disable() - exit a transfer mode that requires retuning
+ * @host: host which should not retune anymore
+ *
+ * It is not meant for temporarily preventing retuning!
+ */
void mmc_retune_disable(struct mmc_host *host)
{
mmc_retune_unpause(host);
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] mmc: host: factor out clearing the retune state
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
2021-06-24 15:16 ` [PATCH 1/3] mmc: core: clear flags before allowing to retune Wolfram Sang
2021-06-24 15:16 ` [PATCH 2/3] mmc: host: add kdoc for mmc_retune_{en|dis}able Wolfram Sang
@ 2021-06-24 15:16 ` Wolfram Sang
2021-06-24 16:06 ` [PATCH 0/3] mmc: avoid vicious circle when retuning Adrian Hunter
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2021-06-24 15:16 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, Adrian Hunter, Yoshihiro Shimoda, Wolfram Sang
We have this in two places, so let's have a dedicated function. It is
also more readable.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/mmc/core/core.c | 3 +--
drivers/mmc/core/host.c | 3 +--
drivers/mmc/core/host.h | 6 ++++++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f397cf051b8d..469bc58c2113 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -941,8 +941,7 @@ int mmc_execute_tuning(struct mmc_card *card)
pr_err("%s: tuning execution failed: %d\n",
mmc_hostname(host), err);
} else {
- host->retune_now = 0;
- host->need_retune = 0;
+ mmc_retune_clear(host);
mmc_retune_enable(host);
}
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 0f084c9b2684..52d37587cf45 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -141,8 +141,7 @@ void mmc_retune_disable(struct mmc_host *host)
mmc_retune_unpause(host);
host->can_retune = 0;
del_timer_sync(&host->retune_timer);
- host->retune_now = 0;
- host->need_retune = 0;
+ mmc_retune_clear(host);
}
void mmc_retune_timer_stop(struct mmc_host *host)
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index ba407617ed23..48c4952512a5 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -21,6 +21,12 @@ int mmc_retune(struct mmc_host *host);
void mmc_retune_pause(struct mmc_host *host);
void mmc_retune_unpause(struct mmc_host *host);
+static inline void mmc_retune_clear(struct mmc_host *host)
+{
+ host->retune_now = 0;
+ host->need_retune = 0;
+}
+
static inline void mmc_retune_hold_now(struct mmc_host *host)
{
host->retune_now = 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] mmc: avoid vicious circle when retuning
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
` (2 preceding siblings ...)
2021-06-24 15:16 ` [PATCH 3/3] mmc: host: factor out clearing the retune state Wolfram Sang
@ 2021-06-24 16:06 ` Adrian Hunter
2021-06-25 9:31 ` Yoshihiro Shimoda
2021-06-29 15:08 ` Ulf Hansson
5 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2021-06-24 16:06 UTC (permalink / raw)
To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Ulf Hansson
On 24/06/21 6:16 pm, Wolfram Sang wrote:
> See patch 1 for a description of the problem. This series implements the
> alternative approach suggested by Adrian (thanks!). It also adds some
> documentation and a minor cleanup which I came up with while working on
> the fix. Patch 1 can go to stable as is, the rest built on top of that.
>
> This series fixes the performance issue which we saw when injecting CRC
> errors on Renesas R-Car Gen3 hardware.
>
> Looking forward to comments!
Looks good to me. For all 3 patches:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>
> Wolfram Sang (3):
> mmc: core: clear flags before allowing to retune
> mmc: host: add kdoc for mmc_retune_{en|dis}able
> mmc: host: factor out clearing the retune state
>
> drivers/mmc/core/core.c | 6 ++++--
> drivers/mmc/core/host.c | 13 +++++++++++--
> drivers/mmc/core/host.h | 6 ++++++
> 3 files changed, 21 insertions(+), 4 deletions(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 0/3] mmc: avoid vicious circle when retuning
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
` (3 preceding siblings ...)
2021-06-24 16:06 ` [PATCH 0/3] mmc: avoid vicious circle when retuning Adrian Hunter
@ 2021-06-25 9:31 ` Yoshihiro Shimoda
2021-06-29 15:08 ` Ulf Hansson
5 siblings, 0 replies; 7+ messages in thread
From: Yoshihiro Shimoda @ 2021-06-25 9:31 UTC (permalink / raw)
To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Adrian Hunter
Hi Wolfram-san,
Thank you for the patches!
> From: Wolfram Sang, Sent: Friday, June 25, 2021 12:16 AM
>
> See patch 1 for a description of the problem. This series implements the
> alternative approach suggested by Adrian (thanks!). It also adds some
> documentation and a minor cleanup which I came up with while working on
> the fix. Patch 1 can go to stable as is, the rest built on top of that.
Perhaps, we can add a Fixes tag into the patch 1 like below?
Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors")
> This series fixes the performance issue which we saw when injecting CRC
> errors on Renesas R-Car Gen3 hardware.
>
> Looking forward to comments!
The patches look good to me. So,
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
And, I tested on my environment (r8a77951-salvator-xs) with local error
injection, and the performance issue disappeared. So,
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Best regards,
Yoshihiro Shimoda
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] mmc: avoid vicious circle when retuning
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
` (4 preceding siblings ...)
2021-06-25 9:31 ` Yoshihiro Shimoda
@ 2021-06-29 15:08 ` Ulf Hansson
5 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2021-06-29 15:08 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Adrian Hunter, Yoshihiro Shimoda
On Thu, 24 Jun 2021 at 17:16, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> See patch 1 for a description of the problem. This series implements the
> alternative approach suggested by Adrian (thanks!). It also adds some
> documentation and a minor cleanup which I came up with while working on
> the fix. Patch 1 can go to stable as is, the rest built on top of that.
>
> This series fixes the performance issue which we saw when injecting CRC
> errors on Renesas R-Car Gen3 hardware.
>
> Looking forward to comments!
>
>
> Wolfram Sang (3):
> mmc: core: clear flags before allowing to retune
> mmc: host: add kdoc for mmc_retune_{en|dis}able
> mmc: host: factor out clearing the retune state
>
> drivers/mmc/core/core.c | 6 ++++--
> drivers/mmc/core/host.c | 13 +++++++++++--
> drivers/mmc/core/host.h | 6 ++++++
> 3 files changed, 21 insertions(+), 4 deletions(-)
>
> --
> 2.30.2
>
Patch1 applied for fixes and by adding a fixes+stable tag. Patch2 and
patch3, queued up for v5.15 (temporary on the devel branch).
Thanks and kind regards
Uffe
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-29 15:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 15:16 [PATCH 0/3] mmc: avoid vicious circle when retuning Wolfram Sang
2021-06-24 15:16 ` [PATCH 1/3] mmc: core: clear flags before allowing to retune Wolfram Sang
2021-06-24 15:16 ` [PATCH 2/3] mmc: host: add kdoc for mmc_retune_{en|dis}able Wolfram Sang
2021-06-24 15:16 ` [PATCH 3/3] mmc: host: factor out clearing the retune state Wolfram Sang
2021-06-24 16:06 ` [PATCH 0/3] mmc: avoid vicious circle when retuning Adrian Hunter
2021-06-25 9:31 ` Yoshihiro Shimoda
2021-06-29 15:08 ` Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.