All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: blk: add emmc cache flush in shutdown callback
@ 2014-07-14  9:34 Yunpeng Gao
  2014-07-14  9:51 ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Yunpeng Gao @ 2014-07-14  9:34 UTC (permalink / raw)
  To: linux-mmc; +Cc: Yunpeng Gao

If eMMC Cache feature enabled, we'd better flush
eMMC cache in the shutdown callback. Otherwise
data corruption issue may be observed.

Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
---
 drivers/mmc/card/block.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782b..8a4010e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card *card)
 static void mmc_blk_shutdown(struct mmc_card *card)
 {
 	_mmc_blk_suspend(card);
+
+	mmc_claim_host(card->host);
+	mmc_flush_cache(card);
+	mmc_release_host(card->host);
 }
 
 #ifdef CONFIG_PM
-- 
1.7.9.5


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

* Re: [PATCH] mmc: blk: add emmc cache flush in shutdown callback
  2014-07-14  9:34 [PATCH] mmc: blk: add emmc cache flush in shutdown callback Yunpeng Gao
@ 2014-07-14  9:51 ` Jaehoon Chung
  2014-07-14 11:09   ` Gao, Yunpeng
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2014-07-14  9:51 UTC (permalink / raw)
  To: Yunpeng Gao, linux-mmc

Hi,

On 07/14/2014 06:34 PM, Yunpeng Gao wrote:
> If eMMC Cache feature enabled, we'd better flush
> eMMC cache in the shutdown callback. Otherwise
> data corruption issue may be observed.

I knew mmc_flush_cache() is called into mmc_shutdown() (driver/mmc/core/mmc.c)
Which data corruption is occurred? Could you explain more?

Best Regards,
Jaehoon Chung 

> 
> Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
> ---
>  drivers/mmc/card/block.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 452782b..8a4010e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card *card)
>  static void mmc_blk_shutdown(struct mmc_card *card)
>  {
>  	_mmc_blk_suspend(card);
> +
> +	mmc_claim_host(card->host);
> +	mmc_flush_cache(card);
> +	mmc_release_host(card->host);
>  }
>  
>  #ifdef CONFIG_PM
> 


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

* RE: [PATCH] mmc: blk: add emmc cache flush in shutdown callback
  2014-07-14  9:51 ` Jaehoon Chung
@ 2014-07-14 11:09   ` Gao, Yunpeng
  0 siblings, 0 replies; 3+ messages in thread
From: Gao, Yunpeng @ 2014-07-14 11:09 UTC (permalink / raw)
  To: Jaehoon Chung, linux-mmc@vger.kernel.org

Thanks a lot for the review and comments.

This patch was derived from our old mmc driver code base, which was based on kernel 3.10 and did not implemented the mmc_shutdown() callback in mmc.c yet.
So it added shutdown callback in drivers/mmc/card/block.c to fix data corruption issue observed at that time.

Since flush eMMC cache in mmc_shutdown() callback is better than in mmc_blk_shutdown(), I think my patch is not needed for current upstream mmc driver any more.
Please ignore it :-)

Thanks.

Regards,
Yunpeng

-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung@samsung.com] 
Sent: Monday, July 14, 2014 5:51 PM
To: Gao, Yunpeng; linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: blk: add emmc cache flush in shutdown callback

Hi,

On 07/14/2014 06:34 PM, Yunpeng Gao wrote:
> If eMMC Cache feature enabled, we'd better flush eMMC cache in the 
> shutdown callback. Otherwise data corruption issue may be observed.

I knew mmc_flush_cache() is called into mmc_shutdown() (driver/mmc/core/mmc.c) Which data corruption is occurred? Could you explain more?

Best Regards,
Jaehoon Chung 

> 
> Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
> ---
>  drivers/mmc/card/block.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 
> 452782b..8a4010e 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card 
> *card)  static void mmc_blk_shutdown(struct mmc_card *card)  {
>  	_mmc_blk_suspend(card);
> +
> +	mmc_claim_host(card->host);
> +	mmc_flush_cache(card);
> +	mmc_release_host(card->host);
>  }
>  
>  #ifdef CONFIG_PM
> 


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14  9:34 [PATCH] mmc: blk: add emmc cache flush in shutdown callback Yunpeng Gao
2014-07-14  9:51 ` Jaehoon Chung
2014-07-14 11:09   ` Gao, Yunpeng

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.