From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Aaron Lu <aaron.lu@intel.com>, Philip Rakity <prakity@nvidia.com>,
Al Cooper <alcooperx@gmail.com>,
Arend van Spriel <arend@broadcom.com>
Subject: Re: [PATCH V6 08/15] mmc: mmc: Hold re-tuning if the card is put to sleep
Date: Wed, 06 May 2015 15:42:02 +0300 [thread overview]
Message-ID: <554A0C1A.60000@intel.com> (raw)
In-Reply-To: <CAPDyKFpUNaMHKuw06VmAQPbWt3hh5GZJYJ_ZEdB4TePZ31N+RA@mail.gmail.com>
On 06/05/15 14:36, Ulf Hansson wrote:
> [...]
>
>>>>> Instead of add mmc_retune_hold|release() to _mmc_suspend(), I would
>>>>> like you to move that handling into mmc_sleep(). The code should be
>>>>> easier and it becomes more clear that it's because of a command
>>>>> sequence.
>>>>>
>>>>> I think mmc_retune_hold() should be invoked before mmc_wait_for_cmd()
>>>>> and then mmc_retune_release() just after, in mmc_sleep(). That should
>>>>> work, right!?
>>>>
>>>> That would be the same as holding re-tuning for that request, which is
>>>> what already happens i.e. adding hold()/release() around mmc_wait_for_cmd()
>>>> is redundant.
>>>
>>> I don't understand your point, sorry.
>>
>> mmc_wait_for_cmd() calls mmc_wait_for_req() which calls __mmc_start_req()
>> which calls mmc_start_request() which calls mmc_retune_hold()
>>
>> Then mmc_wait_for_req() calls mmc_wait_for_req_done() which calls
>> mmc_retune_release().
>>
>> So
>> mmc_wait_for_cmd() (with no retries)
>> has the same effect as
>> mmc_retune_hold()
>> mmc_wait_for_cmd()
>> mmc_retune_release()
>>
>
> Huh, you are right - again.
>
> There have been a couple of iterations of this patchset, I don't
> recall why we need to hold retune for all requests? It seems awkward.
> Shouldn't we just hold retune for those requests that needs it?
For data requests (which also call __mmc_start_req()) there is the
possibility that a 'write' is not finished and is polled with CMD13.
So re-tuning is held to avoid conflicting with the busy state.
It also aids controlling when re-tuning happens in the recovery path
i.e. we have a go at getting the status first and if that doesn't
work first time, then re-tune if needed.
Also mmc_retune_hold() does not only hold retuning, it also causes
re-tuning to happen if the hold_count was zero, so it does
"make-retuning-happen-if-needed-and-not-already-held-and-then-hold-retuning"
>
>>>
>>> Anyway, my proposal didn't quite work, which is due to that
>>> mmc_deselect_cards() (invoked from mmc_sleep()) deals with retries. If
>>> there had been only one try, I thought it could be okay to have that
>>> command to be preceded by a re-tune.
>>>
>>> Anyway, I would like you to move the mmc_retune_hold|release() calls
>>> into the mmc_sleep() function.
>>
>> That would have no effect as explained above.
>
> Then why did you add it to the _mmc_suspend() function? What am I missing here?
It was added in response to our discussions. It was not in my original
patches. I can take it out.
>
>>
>>>
>>>>
>>>> The options for the caller are:
>>>>
>>>> 1)
>>>> hold re-tuning
>>>> put emmc to sleep
>>>> later wake up emmc
>>>> release re-tuning
>>>>
>>>> 2)
>>>> put emmc to sleep
>>>> later increment hold_count
>>>> wake up emmc ignoring CRC errors
>>>> release re-tuning
>>>>
>>>> But there is no wake-up function and the suspend path is using an unbalanced
>>>> mmc_sleep i.e. no corresponding wake up.
>>>>
>>>> So that leaves what is happening now i.e. a comment plus explicit
>>>> hold()/release() in _mmc_suspend() so that future changes to _mmc_suspend()
>>>> know to take mmc_sleep re-tuning requirements into account.
>>>
>>> Why all this complexity?
>>>
>>> mmc_power_off() is called in _mmc_suspend(), that will eventually
>>> disable re-tune. Thus re-tuning will be prevented for
>>> commands/requests during the system PM resume sequence, until the card
>>> has been fully re-initialized (and a tuning sequence done). Isn't that
>>> sufficient?
>>
>> Yes my original patch did not have any of that complexity. I added it in
>> response to our discussions.
>>
>> As you wrote, _mmc_suspend() does not need to do anything with retuning
>> because mmc_sleep() is followed by mmc_power_off().
>>
>> The original patch added a comment to mmc_sleep() and that was all. That
>> would still be the best approach.
>>
>
> What I had in mind was that the re-tune timer could time out in the
> middle of the _mmc_suspend() sequence.
>
> If that happens in-between mmc_deselect_cards() and when the CMD5 is
> to be sent, in mmc_sleep() - we must not allow a re-tune sequence.
> Unless holding re-tune here, how is that prevented?
Oh yes, I have overlooked that re-tuning can't be done on a de-selected
card. So I will add mmc_retune_hold()/mmc_retune_release(). I will have to
think about the error handling. It looks broken now anyway since it doesn't
reselect the card in the error path.
next prev parent reply other threads:[~2015-05-06 12:44 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 12:09 [PATCH V6 00/15] mmc: host: Add facility to support re-tuning Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 01/15] " Adrian Hunter
2015-05-04 13:14 ` Ulf Hansson
2015-04-20 12:09 ` [PATCH V6 02/15] mmc: core: Enable / disable re-tuning Adrian Hunter
2015-04-21 8:59 ` Ulf Hansson
2015-04-21 10:37 ` Adrian Hunter
2015-04-28 13:18 ` [PATCH V7 " Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 03/15] mmc: core: Add support for re-tuning before each request Adrian Hunter
2015-05-04 13:28 ` Ulf Hansson
2015-05-06 8:02 ` Adrian Hunter
2015-05-06 9:45 ` Ulf Hansson
2015-05-06 10:17 ` Adrian Hunter
2015-05-06 10:37 ` Ulf Hansson
2015-04-20 12:09 ` [PATCH V6 04/15] mmc: core: Check re-tuning before retrying Adrian Hunter
2015-05-04 13:30 ` Ulf Hansson
2015-04-20 12:09 ` [PATCH V6 05/15] mmc: core: Hold re-tuning during switch commands Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 06/15] mmc: core: Hold re-tuning during erase commands Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 07/15] mmc: core: Hold re-tuning while bkops ongoing Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 08/15] mmc: mmc: Hold re-tuning if the card is put to sleep Adrian Hunter
2015-04-21 9:42 ` Ulf Hansson
2015-04-21 11:00 ` Adrian Hunter
2015-04-21 11:53 ` Ulf Hansson
2015-04-21 12:26 ` Adrian Hunter
2015-04-21 18:25 ` Arend van Spriel
2015-04-22 7:24 ` Adrian Hunter
2015-04-22 8:30 ` Arend van Spriel
2015-04-22 8:45 ` Ulf Hansson
2015-05-04 13:44 ` Ulf Hansson
2015-05-06 8:39 ` Adrian Hunter
2015-05-06 9:32 ` Ulf Hansson
2015-05-06 10:28 ` Adrian Hunter
2015-05-06 11:36 ` Ulf Hansson
2015-05-06 12:42 ` Adrian Hunter [this message]
2015-05-06 13:21 ` Ulf Hansson
2015-05-07 7:49 ` Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 09/15] mmc: core: Separate out the mmc_switch status check so it can be re-used Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 10/15] mmc: core: Add support for HS400 re-tuning Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 11/15] mmc: sdhci: Change to new way of doing re-tuning Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 12/15] mmc: sdhci: Flag re-tuning is needed on CRC or End-Bit errors Adrian Hunter
2015-05-04 13:55 ` Ulf Hansson
2015-05-06 11:09 ` Adrian Hunter
2015-05-06 11:40 ` Ulf Hansson
2015-04-20 12:09 ` [PATCH V6 13/15] mmc: block: Check re-tuning in the recovery path Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 14/15] mmc: block: Retry errored data requests when re-tuning is needed Adrian Hunter
2015-04-20 12:09 ` [PATCH V6 15/15] mmc: core: Don't print reset warning if reset is not supported Adrian Hunter
2015-05-04 10:39 ` [PATCH V6 00/15] mmc: host: Add facility to support re-tuning Adrian Hunter
2015-05-04 13:13 ` 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=554A0C1A.60000@intel.com \
--to=adrian.hunter@intel.com \
--cc=aaron.lu@intel.com \
--cc=alcooperx@gmail.com \
--cc=arend@broadcom.com \
--cc=linux-mmc@vger.kernel.org \
--cc=prakity@nvidia.com \
--cc=ulf.hansson@linaro.org \
/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