Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Joe.Zhou <Joe.Zhou@mediatek.com>
To: <ulf.hansson@linaro.org>
Cc: <Joe.Zhou@mediatek.com>, <Peng.Zhou@mediatek.com>,
	<Sharp.Xia@mediatek.com>, <Sophie.Wang@mediatek.com>,
	<Wey.Zhang@mediatek.com>, <linux-mediatek@lists.infradead.org>,
	<linux-mmc@vger.kernel.org>, <wsd_upstream@mediatek.com>
Subject: Re: [PATCH] mmc: race condition between "sdcard hot plug out" and "system reboot"
Date: Mon, 6 May 2024 11:36:44 +0800	[thread overview]
Message-ID: <20240506033644.10538-1-Joe.Zhou@mediatek.com> (raw)
In-Reply-To: <CAPDyKFoB+r7KMdbV-svz9d=WdPm1Zvd6oZppzbsPDWqX7YN_Kw@mail.gmail.com>

From: Joe Zhou <Joe.Zhou@mediatek.com>

> Thanks for your patch!

> Doesn't commit 66c915d09b94 ("mmc: core: Disable card detect during
> shutdown") take care of this problem?

> Kind regards
> Uffe


Dear Ulf,
     Thank you for your replay!

     I think that commit66c915d09b94 ("mmc: core: Disable card detect during shutdown") doesn't reslove this issue.
     1. Issues may asise in the following processing.
     sdcard hot pulg out:                                  SyS_reboot:
     CPU0                                                  CPU1
     _mmc_detect_change() {
     ......
     mmc_schedule_delayed_work(&host->detect, delay)
     #Step1: call delay work &host->detect
         mmc_rescan()
         {
          .......
              #Step2: detect SD card removed
              mmc_sd_detect() {                              ......
                                                             _mmc_stop_host (.pre_shutdown)
                                                            {
              ......                                        #Step3:_mmc_stop_host() cancel detect use sync
                                                            cancel_delayed_work_sync(&host->detect)
                                                            #Step4: wait delay work complete
                                                            }
                 if (err) {
                 #Step5: host->card is NULL
                 mmc_sd_remove(host);                        ......
                                                            #Step6: wait delay work complete
                                                            mmc_sd_suspend (.shutdown)
                                                            {
                                                             ......

                                                            #Step7:_mmc_sd_suspend claimed host
                                                            mmc_claim_host(host);
                                                            #Step8: use host-card(NULL pointer)
                                                            if (mmc_card_suspended(host->card))
                                                             ......
                                                            }
                 mmc_claim_host(host);
                 mmc_detach_bus(host);
                }
             }
          }
       ......
      }

     2. And in the version that includes the patch, we have reproduced the issue.

Best regards,
Joe

  reply	other threads:[~2024-05-06  3:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 10:38 [PATCH] mmc: race condition between "sdcard hot plug out" and "system reboot" Joe.Zhou
2024-04-25  9:49 ` Ulf Hansson
2024-05-06  3:36   ` Joe.Zhou [this message]
2024-05-06  9:53     ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506033644.10538-1-Joe.Zhou@mediatek.com \
    --to=joe.zhou@mediatek.com \
    --cc=Peng.Zhou@mediatek.com \
    --cc=Sharp.Xia@mediatek.com \
    --cc=Sophie.Wang@mediatek.com \
    --cc=Wey.Zhang@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox