linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: Re: [PATCH V2 1/3] mmc: core: Add a facility to "pause" re-tuning
Date: Wed, 11 May 2016 12:00:08 +0300	[thread overview]
Message-ID: <5732F498.6090203@intel.com> (raw)
In-Reply-To: <CAPDyKFozyrzAPcw3v=XUEkMevLxxZ_AgHWXkwkYPN=AJkTAgXQ@mail.gmail.com>

On 11/05/16 09:48, Ulf Hansson wrote:
> On 10 May 2016 at 15:03, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 10/05/16 15:24, Ulf Hansson wrote:
>>> On 4 May 2016 at 13:38, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>> Re-tuning is not possible when switched to the RPMB
>>>> partition.  However re-tuning should not be needed
>>>> if re-tuning is done immediately before switching,
>>>> a small set of operations is done, and then we
>>>> immediately switch back to the main partition.
>>>>
>>>> To ensure that re-tuning can't be done for a short
>>>> while, add a facility to "pause" re-tuning.
>>>>
>>>> The existing facility to hold / release re-tuning
>>>> is used but it also flags re-tuning as needed to cause
>>>> re-tuning before the next command (which will be the
>>>> switch to RPMB).
>>>>
>>>> We also need to "unpause" in the recovery path, which
>>>> is catered for by adding it to mmc_retune_disable().
>>>>
>>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>>> ---
>>>>  drivers/mmc/core/host.c  | 22 ++++++++++++++++++++++
>>>>  include/linux/mmc/host.h |  4 ++++
>>>>  2 files changed, 26 insertions(+)
>>>>
>>>> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
>>>> index e0a3ee16c0d3..302e5858755a 100644
>>>> --- a/drivers/mmc/core/host.c
>>>> +++ b/drivers/mmc/core/host.c
>>>> @@ -68,8 +68,30 @@ void mmc_retune_enable(struct mmc_host *host)
>>>>                           jiffies + host->retune_period * HZ);
>>>>  }
>>>>
>>>> +/*
>>>> + * Pause re-tuning for a small set of operations.  The pause begins after the
>>>> + * next command and after first doing re-tuning.
>>>> + */
>>>> +void mmc_retune_pause(struct mmc_host *host)
>>>> +{
>>>> +       if (!host->retune_paused) {
>>>> +               host->retune_paused = 1;
>>>> +               mmc_retune_needed(host);
>>>> +               mmc_retune_hold(host);
>>>> +       }
>>>> +}
>>>> +
>>>
>>> When the mmc block device driver is built as a module, this doesn't
>>> build. I will drop the series from my next branch to sort this out.
>>
>> Oops. Sorry!
>>
>>> Should we export these via EXPORT_SYMBOL_GPL, or implement them as
>>> inline functions?
>>
>> They need to be exported.  I tend to go with what else is in the same file
>> i.e. host.c is exporting using EXPORT_SYMBOL()
> 
> Yes, okay!
> 
>>
>>>
>>> This also made me think about the SDIO/WLAN driver issue, during
>>> system PM suspend/resume, which also needed temporary to disable
>>> re-tuning.
>>>
>>> *If* we are going to export these, I want to make it works for the
>>> SDIO case well...
>>
>> SDIO case is slightly different, and SDIO uses its own header file sdio_func.h.
> 
> I what way is it different?

In the RPMB case there are 3 things to do:
	1. Do re-tuning at next command
	2. Hold re-tuning
	3. Release re-tuning

In the SDIO case there are 3 things to do:
	1. Prevent re-tuning at next command
	2. Hold re-tuning
	3. Release re-tuning

So the first thing is different.

> 
> Regarding the header file, my point is that I want to keep the numbers
> of exported functions to a minimum.
> 
> Do you think there is way to combine these two use cases, such only
> one pair of new functions would be needed?

To make them the same we would need to add a parameter to mmc_retune_pause()
i.e. something like

void mmc_retune_pause(struct mmc_host *host, bool retune_now)
{
	if (!host->retune_paused) {
		host->retune_paused = 1;
		mmc_retune_hold(host);
		if (retune_now)
			mmc_retune_needed(host);
		else
			host->retune_now = 0;
	}
}

For SDIO we would need to put the function declarations in sdio_func.h as
well as host.h.

Shall I make a V3 of these patches like that?


  reply	other threads:[~2016-05-11  9:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 11:38 [PATCH V2 0/3] mmc: block: Fix tuning (by avoiding it) for RPMB Adrian Hunter
2016-05-04 11:38 ` [PATCH V2 1/3] mmc: core: Add a facility to "pause" re-tuning Adrian Hunter
2016-05-10 12:24   ` Ulf Hansson
2016-05-10 13:03     ` Adrian Hunter
2016-05-11  6:48       ` Ulf Hansson
2016-05-11  9:00         ` Adrian Hunter [this message]
2016-05-12  6:14           ` Adrian Hunter
2016-05-12 13:20             ` Ulf Hansson
2016-05-12 13:19               ` Adrian Hunter
2016-05-16 12:35                 ` [PATCH V3 " Adrian Hunter
2016-05-17 15:06                   ` Ulf Hansson
2016-05-18  6:44                     ` Adrian Hunter
2016-05-04 11:38 ` [PATCH V2 2/3] mmc: block: Always switch back to main area after RPMB access Adrian Hunter
2016-05-04 11:38 ` [PATCH V2 3/3] mmc: block: Pause re-tuning while switched to the RPMB partition Adrian Hunter
2016-05-04 11:54 ` [PATCH V2 0/3] mmc: block: Fix tuning (by avoiding it) for RPMB Winkler, Tomas
2016-05-10 10:28 ` 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=5732F498.6090203@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tomas.winkler@intel.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;
as well as URLs for NNTP newsgroup(s).